maxBy

inline suspend fun <E, R : Comparable<R>> ReceiveChannel<E>.maxBy(
    selector: (E) -> R
): E?
(source)

Platform and version requirements: JVM

Returns the first element yielding the largest value of the given function or null if there are no elements.

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