public final class ConcurrentLightHashMap extends Object
AbstractMap.SimpleImmutableEntry. When the map is empty the field is null. In situations where is
likely that the map will contain no or only one entry there is no memory overhead incurred by
allocating the map.
The value is not referenced by objects of this class but all operations use a
AtomicReferenceFieldUpdater to a storage location of type Object. This location
is then populated with three possible values:
null
AbstractMap.SimpleImmutableEntry.
ConcurrentHashMap storing the entries
null keys or values.| Modifier and Type | Method and Description |
|---|---|
static <U> void |
clear(U holder,
AtomicReferenceFieldUpdater<U,Object> updater) |
static <K,V,U> V |
computeIfAbsent(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
K key,
Function<? super K,? extends V> mappingFunction)
Sets the key to the value computed by the mapping function if there is no mapping for the
key.
|
static <K,V,U> void |
forEach(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
BiConsumer<? super K,? super V> action) |
static <K,V,U> V |
get(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
K key) |
static <K,V,U> Map<K,V> |
getEntries(U holder,
AtomicReferenceFieldUpdater<U,Object> updater) |
static <K,V,U> V |
getOrDefault(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
K key,
V defaultValue) |
static <K,V,U> V |
putIfAbsent(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
K newKey,
V newValue)
If the specified key is not already associated with a value, associates it with the given
value.
|
static <K,V,U> boolean |
remove(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
K key) |
static <K,V,U> boolean |
removeIf(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
Predicate<Map.Entry<K,V>> filter) |
public static <K,V,U> V putIfAbsent(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
K newKey,
V newValue)
NullPointerException - if the specified key or value is nullpublic static <K,V,U> V computeIfAbsent(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
K key,
Function<? super K,? extends V> mappingFunction)
NullPointerException - if the specified key is null, since this map does not support
null keys, or the mappingFunction is nullpublic static <K,V,U> V getOrDefault(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
K key,
V defaultValue)
public static <K,V,U> V get(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
K key)
public static <K,V,U> Map<K,V> getEntries(U holder, AtomicReferenceFieldUpdater<U,Object> updater)
public static <K,V,U> void forEach(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
BiConsumer<? super K,? super V> action)
public static <K,V,U> boolean remove(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
K key)
public static <K,V,U> boolean removeIf(U holder,
AtomicReferenceFieldUpdater<U,Object> updater,
Predicate<Map.Entry<K,V>> filter)
public static <U> void clear(U holder,
AtomicReferenceFieldUpdater<U,Object> updater)