distinctBy

fun <E, K> ReceiveChannel<E>.distinctBy(
    context: CoroutineContext = Unconfined,
    selector: suspend (E) -> K
): ReceiveChannel<E>
(source)

Platform and version requirements: JVM

Returns a channel containing only elements from the given channel having distinct keys returned by the given selector function.

The elements in the resulting channel are in the same order as they were in the source channel.

The operation is intermediate and stateful. This function consumes all elements of the original ReceiveChannel.