RFR(s): 8132800: clarify stream package documentation regarding sequential vs parallel modes

Tagir Valeev amaembo at gmail.com
Sat Aug 1 04:36:05 UTC 2015


Probably additional clarifications should be added about Stream.concat
method (and primitive analogs). Currently it's unclear that the resulting
stream is actually the new pipeline, which do not propagate parallel status
to the concatenated streams. See also my StackOverflow question:

Also things become more complex in JDK9 with the introduction of
takeWhile/dropWhile. For JDK Stream implementation these two are normal
intermediate operations, but if it happens that user has his own stream
implementation or delegate to JDK stream, then the default
takeWhile/dropWhile implementation is used which is actually starts new
pipeline at given point, so further changes of parallel/sequential mode are
not propagated to the initial pipeline. In my StreamEx library I call such
operations as "quasi-intermediate", and explicitly clarify this point. See
the JavaDoc:
Probably some clarification should be added to @implSpec section of

With best regards,
Tagir Valeev.

On Sat, Aug 1, 2015 at 3:19 AM, Stuart Marks <stuart.marks at oracle.com>

> Hi all,
> The sequential() and parallel() methods on a stream set the execution mode
> for the entire pipeline. Unfortunately this isn't particularly clear from
> the documentation. This has been a recurring question. Please review this
> change to the java.util.stream package documentation to help clarify this
> point.
> I've also added a couple anchor tags that were missing from various
> sections.
> This is intended to be a purely editorial change, not a specification
> change.
> Bug:
>         https://bugs.openjdk.java.net/browse/JDK-8132800
> Webrev:
>         http://cr.openjdk.java.net/~smarks/reviews/8132800/webrev.0/
> Thanks,
> s'marks

More information about the core-libs-dev mailing list