Into (original) (raw)

Remi Forax forax at univ-mlv.fr
Wed Dec 26 11:05:19 PST 2012


On 12/26/2012 07:38 PM, Brian Goetz wrote:

Since we can't read the user's mind about whether they care about encounter order or not (e.g., they may use a List because there's no Multiset implementation handy), I think we need to provide ways of aggregating that let the user explicitly choose between order-preserving aggregation and concurrent aggregation. I think having the word "concurrent" in the code somewhere isn't a bad clue.

This defeat one important purpose of the Stream API which is to be parallel/sequential agnostic from the user POV. And again, people will use a parallel streams without the concurrent aggregator.

What about this use case ? List extractList(Stream stream) { return stream. ... ops ... // <-- please complete } ... main(...) { Collection c = ... extractList(c.stream()); extractList(c.parallelStream()); }

Here having a toList() that take care about concurrency if needed is very appealing.

Rémi



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