JDK-8042355 stream with sorted() causes downstream ops not to be lazy
paul.sandoz at oracle.com
Mon May 5 13:16:02 UTC 2014
This is an optimization to ensure that sorted() in sequential pipelines does not aggressively push all sorted elements downstream if the pipeline is known to be short-circuiting.
Note that it is not an error that more elements, than strictly required to produce a result, may flow through the pipeline. This can occur, in general (not restricted to just sorting), for short-circuiting parallel pipelines.
More information about the core-libs-dev