zip

infix fun <E, R> ReceiveChannel<E>.zip(
    other: ReceiveChannel<R>
): ReceiveChannel<Pair<E, R>>
(source)

Platform and version requirements: JVM

Returns a channel of pairs built from elements of both channels with same indexes. Resulting channel has length of shortest input channel.

The operation is intermediate and stateless. This function consumes all elements of both the original ReceiveChannel and the other one.

fun <E, R, V> ReceiveChannel<E>.zip(
    other: ReceiveChannel<R>,
    context: CoroutineContext = Unconfined,
    transform: (a: E, b: R) -> V
): ReceiveChannel<V>
(source)

Platform and version requirements: JVM

Returns a channel of values built from elements of both collections with same indexes using provided transform. Resulting channel has length of shortest input channels.

The operation is intermediate and stateless. This function consumes all elements of both the original ReceiveChannel and the other one.