lastOrNull

suspend fun <E> ReceiveChannel<E>.lastOrNull(): E? (source)

Platform and version requirements: JVM

Returns the last element, or null if the channel is empty.

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

inline suspend fun <E> ReceiveChannel<E>.lastOrNull(
    predicate: (E) -> Boolean
): E?
(source)

Platform and version requirements: JVM

Returns the last element matching the given predicate, or null if no such element was found.

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