ConcurrentHashMap/ConcurrentMap/Map.compute
Doug Lea
dl at cs.oswego.edu
Fri Dec 14 10:20:41 PST 2012
On 12/14/12 13:02, Brian Goetz wrote:
>>> We do not have explicit parallel versions of forEach for anything yet.
>>> Existing
>>> forEach methods are inherently sequential.
>>
>> But does any spec promise this?
>
> If you want parallel forEach you can do:
>
> coll.parallel().forEach()
But what's up with Maps?
>> But given computeIfAbsent, the name computeIfPresent seems forced,
>> and then computeIfAbsentOrPresent==compute seems forced. And if you
>> see the scheme laid out in this way, looks OK. Which is presumably
>> why all the CHMV8 users seem to like it.
>
> What about recompute for compute, and recomputeIfPresent for computeIfPresent?
I forget what c-i list feedback led me to change the initial
CHMV8 recompute() to computeIfPresent() but I can scan archives/replies
if anyone cares.
> (The former has a slight weirdness about the first time, since you can't
> recompute something that isn't yet computed,
Sounds like it a product of the Department of Redundancy Department :-)
Sorry to resist all these suggestions, I'd list some of
my own, but then I would be forced to reply to myself about
why just living with "compute" is good enough :-)
-Doug
More information about the lambda-libs-spec-observers
mailing list