str #20262 reduce should fail explicitly on empty stream (#20267)

* str #20262 reduce should fail explicitly on empty stream

* str #20262 document reduce behaviour on empty stream
This commit is contained in:
Konrad Malawski 2016-04-11 15:36:10 +02:00
parent 503a77f515
commit b9ab232cac
8 changed files with 67 additions and 14 deletions

View file

@ -573,6 +573,11 @@ final class Flow[-In, +Out, +Mat](delegate: scaladsl.Flow[In, Out, Mat]) extends
* Applies the given function towards its current and next value,
* yielding the next current value.
*
* If the stream is empty (i.e. completes before signalling any elements),
* the reduce stage will fail its downstream with a [[NoSuchElementException]],
* which is semantically in-line with that Scala's standard library collections
* do in such situations.
*
* '''Emits when''' upstream completes
*
* '''Backpressures when''' downstream backpressures