arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / zip

zip

fun <B> zip(that: Stream<B>): Stream<Pair<O, B>>

Deterministically zips elements, terminating when the end of either branch is reached naturally.

import arrow.fx.coroutines.stream.*

//sampleStart
suspend fun main(): Unit =
  Stream(1, 2, 3).zip(Stream(4, 5, 6, 7))
  .toList()
  .let(::println) //[(1,4), (2,5), (3,6)]
//sampleEnd

Do you like Arrow?

Arrow Org
<