You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `lastOption` operator returns the last element in `Source` wrapped in
`Some` or `None` in case when source is empty or failed. Note that this
is a terminal operation for source e.g.:
Source.empty[Int].lastOption() // None
val s = Source.fromValues(1, 2)
s.lastOption() // Some(2)
s.receive() // ChannelClosed.Done
The `last` operator returns the last element in `Source` or throws
`NoSuchElementException` in case when it is empty. In case when `receive()`
fails then `ChannelClosedException.Error` exception is thrown. It is also
a terminal operation e.g.:
Source.empty[Int].last() // throws NoSuchElementException("cannot obtain last from an empty source")
val s = Source.fromValues(1, 2)
s.last() // 2
s.receive() // ChannelClosed.Done
Note that ChannelClosedException.Error was improved to contain `cause`
exception (if available).
0 commit comments