arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / zipWithNext
fun zipWithNext(): Stream<Pair<O, O?>>
Zips each element of this stream with the next element wrapped into Some.
The last element is zipped with None.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream("The", "quick", "brown", "fox")
.zipWithNext()
.toList()
.let(::println) //[(The,quick), (quick,brown), (brown,fox), (fox,null)]
//sampleEnd
Do you like Arrow?
✖