arrow-fx-coroutines / arrow.fx.coroutines.stream / lastOrError

lastOrError

suspend fun <O> Stream<O>.lastOrError(): O

Runs all the effects of this Stream, raising a NoSuchElementException if the stream emitted no values, and returning the last value emitted otherwise.

This a terminal operator, meaning this functions suspends until the Stream finishes. If any errors are raised while streaming, it’s thrown from this suspend scope.

Do you like Arrow?

Arrow Org
<