No 'fold left' without a combiner ?
brian.goetz at oracle.com
Mon Sep 9 08:32:51 PDT 2013
> or better, have a foldLeft (or whatever it's name) on Stream that throws
> an IllegalStateException if the stream is parallel.
No, that's not better :)
The pervasive sequential-think that most developers bring to the table
in 2013 is not anyone's friend. We've gone to great effort to design an
API where, if properly used, works correctly regardless of whether the
pipeline executes sequentially or in parallel. The result is a cleaner
and simpler API, and one that better prepares developers for computing
in the coming decade.
Adding a handful of sequential-only operations may make certain use
cases easier, but there's a hidden cost -- reasoning about stream
pipelines becomes harder for everyone, because now parallel
compatibility becomes an element of the model which must be considered.
Short-term gain, long-term pain. No thank you!
Please deposit your sequential glasses in the bin by the door. You
won't be needing them any more.
More information about the lambda-libs-spec-observers