mapTo

inline suspend fun <E, R, C : MutableCollection<in R>> ReceiveChannel<E>.mapTo(
    destination: C,
    transform: (E) -> R
): C
(source)

Platform and version requirements: JVM

Applies the given transform function to each element of the original channel and appends the results to the given destination.

The operation is terminal. This function consumes all elements of the original ReceiveChannel.