ChannelIterator

interface ChannelIterator<out E> (source)

Platform and version requirements: JVM

Iterator for ReceiveChannel. Instances of this interface are not thread-safe and shall not be used from concurrent coroutines.

Functions

hasNext

abstract operator suspend fun hasNext(): Boolean

Returns true if the channel has more elements suspending the caller while this channel isEmpty or returns false if the channel isClosedForReceive without cause. It throws the original close cause exception if the channel has failed.

next

abstract operator suspend fun next(): E

Retrieves and removes the element from this channel suspending the caller while this channel isEmpty or throws ClosedReceiveChannelException if the channel isClosedForReceive without cause. It throws the original close cause exception if the channel has failed.