[concurrency-interest] MappingFunction for ConcrrentMap.replace()

Doug Lea dl at cs.oswego.edu
Sun Jul 15 07:14:35 EDT 2012


On 07/15/12 07:04, Alex Lam S.L. wrote:
> After encountering the need for CSKLM.computeIfAbsent(), I now run
> into a case where I would like a variation of replace(K,V,V) which
> does:
>
> replace(key, expected, mappingFunction)

A variant of this that you should be able to use in such cases
is also in ConcurrentHashMapV8
   compute(key, remappingFunction);
and is on the todo list for CSLM for JDK8. There probably
will not be a preview of this out soon though.
The CSLM updates for both computed-updates and
lambda-ized collection support (Spliterator-like constructions)
are intertwined, and we're still experimenting with the
lambda-support APIs mainly using CHM.

-Doug



More information about the Concurrency-interest mailing list