Sink.last
Materializes into a Future
which will complete with the last value emitted when the stream completes.
Signature
Description
Materializes into a Future
which will complete with the last value emitted when the stream completes. If the stream completes with no elements the Future
is failed.
Example
- Scala
-
source
val source = Source(1 to 10) val result: Future[Int] = source.runWith(Sink.last) result.map(println) // 10
- Java
Reactive Streams semantics
cancels never
backpressures never