toSet

suspend fun <E> ReceiveChannel<E>.toSet(): Set<E> (source)

Platform and version requirements: JVM

Returns a Set of all elements.

The returned set preserves the element iteration order of the original channel.

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