sumBy

inline suspend fun <E> ReceiveChannel<E>.sumBy(
    selector: (E) -> Int
): Int
(source)

Platform and version requirements: JVM

Returns the sum of all values produced by selector function applied to each element in the channel.

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