stream() / parallelStream() methods

Brian Goetz brian.goetz at oracle.com
Fri Feb 8 15:24:02 PST 2013


> (Tangentially, I would really love to drop parallelStream() and let
> people call stream().parallel(). But I haven't managed to scour the
> archives to find if that argument's already suitably played out.)

Direct version is more performant, in that it requires less wrapping (to 
turn a stream into a parallel stream, you have to first create the 
sequential stream, then transfer ownership of its state into a new 
Stream.)

But, inconsistently, we have dropped a number of parallel stream 
factories along the same lines, because the 2x explosion of 
intGenerator/parallelIntGenerator was too much.  But considering this is 
just one new method in Iterable/Collection, and it does make a 
difference in a common case, the status quo does seem reasonable.



More information about the lambda-libs-spec-observers mailing list