public static class WrapperCollections.ConcurrentWrapperMap<K,V> extends Object implements ConcurrentMap<K,V>
Modifier and Type | Field and Description |
---|---|
protected Collection<V> |
m_collValues
The values collection.
|
protected boolean |
m_fStrict
Determines whether or not all of the Entry methods are protected;
if set to true, then all Entry methods are protected.
|
protected ReadWriteLock |
m_lock
The read/write lock for concurrency control.
|
protected Lock |
m_lockExclusive
The exclusive lock for performing read/write operations.
|
protected Lock |
m_lockShared
The shared lock for performing read operations.
|
protected Map<K,V> |
m_mapDelegate
The Map to which this wrapper delegates.
|
protected Set<Map.Entry<K,V>> |
m_setEntries
The entry set.
|
protected Set<K> |
m_setKeys
The key set.
|
Modifier | Constructor and Description |
---|---|
protected |
ConcurrentWrapperMap() |
|
ConcurrentWrapperMap(Map<K,V> map)
Create an ConcurrentWrapperMap which delegates to the specified Map.
|
protected |
ConcurrentWrapperMap(Map<K,V> map,
ReadWriteLock lock)
Create an ConcurrentWrapperMap which delegates to the specified Map.
|
protected |
ConcurrentWrapperMap(Map<K,V> map,
ReadWriteLock lock,
boolean fStrict)
Create an ConcurrentWrapperMap which delegates to the specified Map.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
V |
compute(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction) |
V |
computeIfAbsent(K key,
Function<? super K,? extends V> mappingFunction) |
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction) |
boolean |
containsKey(Object oKey) |
boolean |
containsValue(Object oValue) |
Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object oOther) |
void |
forEach(BiConsumer<? super K,? super V> action) |
V |
get(Object oKey) |
protected Map<K,V> |
getDelegate()
Return the Map to which all operations should be delegated to.
|
protected ReadWriteLock |
getLock()
Return the ReadWriteLock that is used to manage concurrent access
and modifications to the underlying map.
|
V |
getOrDefault(Object key,
V defaultValue) |
int |
hashCode() |
boolean |
isEmpty() |
Set<K> |
keySet() |
V |
merge(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction) |
V |
put(K oKey,
V oValue) |
void |
putAll(Map<? extends K,? extends V> map) |
V |
putIfAbsent(K key,
V value) |
V |
remove(Object oKey) |
boolean |
remove(Object key,
Object value) |
V |
replace(K key,
V value) |
boolean |
replace(K key,
V oldValue,
V newValue) |
void |
replaceAll(BiFunction<? super K,? super V,? extends V> function) |
int |
size() |
String |
toString() |
Collection<V> |
values() |
protected final ReadWriteLock m_lock
protected final Lock m_lockShared
protected final Lock m_lockExclusive
protected Collection<V> m_collValues
protected final boolean m_fStrict
protected ConcurrentWrapperMap()
public ConcurrentWrapperMap(Map<K,V> map)
map
- the Map to delegate all calls toprotected ConcurrentWrapperMap(Map<K,V> map, ReadWriteLock lock)
map
- the Map to delegate all calls tolock
- a read/write lock for concurrency managementprotected ConcurrentWrapperMap(Map<K,V> map, ReadWriteLock lock, boolean fStrict)
map
- the Map to delegate all calls tolock
- a read/write lock for concurrency managementfStrict
- pass true to protect all Entry methods; false to
protect only the setValue() methodprotected Map<K,V> getDelegate()
protected ReadWriteLock getLock()
public boolean containsKey(Object oKey)
containsKey
in interface Map<K,V>
public boolean containsValue(Object oValue)
containsValue
in interface Map<K,V>
public V putIfAbsent(K key, V value)
putIfAbsent
in interface ConcurrentMap<K,V>
putIfAbsent
in interface Map<K,V>
public V getOrDefault(Object key, V defaultValue)
getOrDefault
in interface ConcurrentMap<K,V>
getOrDefault
in interface Map<K,V>
public void forEach(BiConsumer<? super K,? super V> action)
public void replaceAll(BiFunction<? super K,? super V,? extends V> function)
replaceAll
in interface ConcurrentMap<K,V>
replaceAll
in interface Map<K,V>
public V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
computeIfAbsent
in interface ConcurrentMap<K,V>
computeIfAbsent
in interface Map<K,V>
public V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
computeIfPresent
in interface ConcurrentMap<K,V>
computeIfPresent
in interface Map<K,V>
public boolean equals(Object oOther)
public int hashCode()