indexOfFirst

inline suspend fun <E> ReceiveChannel<E>.indexOfFirst(
    predicate: (E) -> Boolean
): Int
(source)

Platform and version requirements: JVM

Returns index of the first element matching the given predicate, or -1 if the channel does not contain such element.

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