partition

inline suspend fun <E> ReceiveChannel<E>.partition(
    predicate: (E) -> Boolean
): Pair<List<E>, List<E>>
(source)

Platform and version requirements: JVM

Splits the original channel into pair of lists, where first list contains elements for which predicate yielded true, while second list contains elements for which predicate yielded false.

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