last

suspend fun <E> ReceiveChannel<E>.last(): E (source)

Platform and version requirements: JVM

Returns the last element.

Exceptions

NoSuchElementException -

if the channel is empty.

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

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

Platform and version requirements: JVM

Returns the last element matching the given predicate.

Exceptions

NoSuchElementException -

if no such element is found.

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