Setting of UNORDERED on concurrent collectors
Brian Goetz
brian.goetz at oracle.com
Mon Apr 8 14:54:33 PDT 2013
> Remember, where Collector really shines is not the simple things
> like this, but composite collections, like
>
> Map<Buyer, Map<Seller, Transaction>>
> biggestTransactionByBuyerSelle__r =
> stream.collect(groupingBy(Txn:__:buyer,
> groupingBy(Txn::seller,
>
> maxBy(comparing(Txn::amount))
>
> This is where groupingBy really shines :)
>
> But how is someone supposed to decide if any or some or all of these
> groupingBy's should really be groupingByConcurrent's?
Basically, if they care more about performance than ordering. But
groupingByConcurrent can do all the same cool composed collections that
groupingBy can do.
> If we eliminated groupingByConcurrent in favor of a more explicit form
> in those cases, would that ruin the shine?
I think that would be silly; instead of choosing between "fast" and
"ordered", you would have to choose between "fast" and "ordered and
powerful and flexible." Given that they can have powerful and flexible
if they're willing to give up ordered, why would we do that?
More information about the lambda-libs-spec-experts
mailing list