Simplifying sequential() / parallel()

Doug Lea dl at
Fri Mar 22 08:56:21 PDT 2013

On 03/22/13 10:07, Joe Bowbeer wrote:
> Stateful programming has its issues but that ship has already sailed (in Java).

Although it is worth bearing in mind that most stream functionality
wrt Collections exploits the fact that operations within
traversals are already known to avoid some of the worst unexpected
side-effects -- mutating a collection while you are traversing.
Which normally leads to ConcurrentModificationException for
iterators. A variant of this is preserved when applicable
in Spliterator implementations. People learn quickly to avoid them.
(That's the subject of some of the specs Paul Sandoz has been
adding, which can't be nailed down very well in general because
they are quality-of-implementation issues, but he is trying anyway :-)

Anyway, as the chief advocate for cool mutative algorithmics
in this group, I'm still in favor of saying they don't belong
in any stream op not called forEach.


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