public final class MapUtils extends Object
Note: This utility class is for internal use only. It can be removed at any time.
Modifier and Type | Method and Description |
---|---|
static <K,V> V |
computeIfAbsent(Map<K,V> map,
K key,
Function<K,V> mappingFunction)
ConcurrentHashMap.computeIfAbsent(k,v) locks when k is present.
|
public static <K,V> V computeIfAbsent(Map<K,V> map, K key, Function<K,V> mappingFunction)
Note: This utility is not for a general purpose usage. Carefully consider the removal operations from the map. If you have many remove operations that are critical, do not use this pre-screening.
map
- the ConcurrentHashMap instancekey
- key with which the specified value is to be associatedmappingFunction
- the function to compute a value