public class ReferenceMap<K,V> extends AbstractMap<K,V> implements ConcurrentMap<K,V>
null keys or values. Uses identity equality for
weak and soft keys. Supports remove listener| Modifier and Type | Class and Description |
|---|---|
static class |
ReferenceMap.ReferenceType |
static interface |
ReferenceMap.RemoveValueListener<V> |
protected static interface |
ReferenceMap.Strategy |
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentMap<Object,Object> |
delegate |
protected ReferenceMap.ReferenceType |
keyReferenceType |
protected ReferenceMap.ReferenceType |
valueReferenceType |
| Constructor and Description |
|---|
ReferenceMap(ReferenceMap.ReferenceType keyReferenceType,
ReferenceMap.ReferenceType valueReferenceType) |
ReferenceMap(ReferenceMap.ReferenceType keyReferenceType,
ReferenceMap.ReferenceType valueReferenceType,
ReferenceMap.RemoveValueListener<V> removeValueListener)
Concurrent hash map that wraps keys and/or values based on specified
reference types.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key) |
boolean |
isEmpty() |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> t) |
V |
putIfAbsent(K key,
V value) |
V |
remove(Object key) |
boolean |
remove(Object key,
Object value) |
V |
replace(K key,
V value) |
boolean |
replace(K key,
V oldValue,
V newValue) |
int |
size() |
clone, equals, hashCode, keySet, toString, valuesprotected ConcurrentMap<Object,Object> delegate
protected final ReferenceMap.ReferenceType keyReferenceType
protected final ReferenceMap.ReferenceType valueReferenceType
public ReferenceMap(ReferenceMap.ReferenceType keyReferenceType, ReferenceMap.ReferenceType valueReferenceType)
public ReferenceMap(ReferenceMap.ReferenceType keyReferenceType, ReferenceMap.ReferenceType valueReferenceType, ReferenceMap.RemoveValueListener<V> removeValueListener)
keyReferenceType - key reference typevalueReferenceType - value reference typepublic int size()
public boolean isEmpty()
public boolean containsKey(Object key)
containsKey in interface Map<K,V>containsKey in class AbstractMap<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>containsValue in class AbstractMap<K,V>public void clear()
public V putIfAbsent(K key, V value)
putIfAbsent in interface ConcurrentMap<K,V>public boolean remove(Object key, Object value)
remove in interface ConcurrentMap<K,V>public boolean replace(K key, V oldValue, V newValue)
replace in interface ConcurrentMap<K,V>Copyright © 2014–2015. All rights reserved.