[concurrency-interest] Adding a createIfAbsent() API?
kasper at kav.dk
Wed Jan 9 14:56:54 EST 2008
Sorry for bringing up this old discussion, but since we have Ops.Mapper
now. Wouldn't it make sense to add
V createIfAbsent(K key, Ops.Generator<? extends V> generator)
V createIfAbsent(K key, Ops.Mapper<? super K, ? extends V> mapper)
to ConcurrentHashMap and ConcurrentSkipListMap
Rowlands, Ben (IT) wrote:
> I often find a need for an API like:
> public V createIfAbsent( K key, Callable<V> creator ) throws
> Similar in operation to putIfAbsent() but taking a callback that is used
> to resolve the value if one isn't found at at the key.
More information about the Concurrency-interest