toCollection

suspend fun <E, C : MutableCollection<in E>> ReceiveChannel<E>.toCollection(
    destination: C
): C
(source)

Platform and version requirements: JVM

Appends all elements to the given destination collection.

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