Simplifying sequential() / parallel()

Brian Goetz brian.goetz at oracle.com
Thu Mar 21 13:21:26 PDT 2013


>> Before we go there, does anyone have use cases for .sequential() /
>> .parallel() that *don't* put the parallel right after the source, or
>> the sequential right before a forEach?
>
> Supporting stateful mappers or filters require to be able to use
> sequential()
> just before them if the start of the stream is parallel.
> We may just not supporting them.

Good point.

Even given that, I'm still OK with the simplification; I do not really 
want to cater to stateful lambdas, that's always been explicitly outside 
of the design center for this library.

In fact, I've been working yesterday on the spec for statefulness and 
non-interference, and I'm pretty comfortable just saying "lambdas passed 
to stream ops should not be stateful, if they are, this may result in 
wrong or non-deterministic outcomes."

Does anyone feel otherwise?



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