mapIndexedTo
inline suspend fun <E, R, C : MutableCollection<in R>> ReceiveChannel<E>.mapIndexedTo(
destination: C,
transform: (index: Int, E) -> R
): C
(source)Platform and version requirements: JVM
Applies the given transform function to each element and its index in the original channel and appends the results to the given destination.
Parameters
transform
-
function that takes the index of an element and the element itself and returns the result of the transform applied to the element.
The operation is terminal. This function consumes all elements of the original ReceiveChannel.