withIndex

fun <E> ReceiveChannel<E>.withIndex(
    context: CoroutineContext = Unconfined
): ReceiveChannel<IndexedValue<E>>
(source)

Platform and version requirements: JVM

Returns a channel of IndexedValue for each element of the original channel.

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