arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / zipWithIndex
fun zipWithIndex(): Stream<Pair<O, Long>>
Zips the elements of the input stream with its indices, and returns the new stream.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream("The", "quick", "brown", "fox")
.zipWithIndex()
.toList()
.let(::println) //[(The,0), (quick,1), (brown,2), (fox,3)]
//sampleEnd
Do you like Arrow?
✖