|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
com.alibaba.druid.util.ConcurrentIdentityHashMap<K,V>
K - the type of keys maintained by this mapV - the type of mapped valuespublic class ConcurrentIdentityHashMap<K,V>
An alternative identity-comparing ConcurrentMap which is similar to
ConcurrentHashMap.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
ConcurrentIdentityHashMap()
Creates a new, empty map with a default initial capacity (16), reference types (weak keys, strong values), default load factor (0.75) and concurrencyLevel (16). |
|
ConcurrentIdentityHashMap(int initialCapacity)
Creates a new, empty map with the specified initial capacity, and with default reference types (weak keys, strong values), load factor (0.75) and concurrencyLevel (16). |
|
ConcurrentIdentityHashMap(int initialCapacity,
float loadFactor)
Creates a new, empty map with the specified initial capacity and load factor and with the default reference types (weak keys, strong values), and concurrencyLevel (16). |
|
ConcurrentIdentityHashMap(int initialCapacity,
float loadFactor,
int concurrencyLevel)
Creates a new, empty map with the specified initial capacity, load factor and concurrency level. |
|
ConcurrentIdentityHashMap(Map<? extends K,? extends V> m)
Creates a new map with the same mappings as the given map. |
|
| Method Summary | |
|---|---|
void |
clear()
Removes all of the mappings from this map. |
boolean |
contains(Object value)
|
boolean |
containsKey(Object key)
Tests if the specified object is a key in this table. |
boolean |
containsValue(Object value)
Returns true if this map maps one or more keys to the specified value. |
Enumeration<V> |
elements()
Returns an enumeration of the values in this table. |
Set<Map.Entry<K,V>> |
entrySet()
|
V |
get(Object key)
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the
key. |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings. |
Enumeration<K> |
keys()
Returns an enumeration of the keys in this table. |
Set<K> |
keySet()
|
V |
put(K key,
V value)
Maps the specified key to the specified value in this table. |
void |
putAll(Map<? extends K,? extends V> m)
Copies all of the mappings from the specified map to this one. |
V |
putIfAbsent(K key,
V value)
|
V |
remove(Object key)
Removes the key (and its corresponding value) from this map. |
boolean |
remove(Object key,
Object value)
|
V |
replace(K key,
V value)
|
boolean |
replace(K key,
V oldValue,
V newValue)
|
int |
size()
Returns the number of key-value mappings in this map. |
Collection<V> |
values()
|
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public ConcurrentIdentityHashMap(int initialCapacity,
float loadFactor,
int concurrencyLevel)
initialCapacity - the initial capacity. The implementation performs internal sizing to accommodate this many
elements.loadFactor - the load factor threshold, used to control resizing. Resizing may be performed when the average
number of elements per bin exceeds this threshold.concurrencyLevel - the estimated number of concurrently updating threads. The implementation performs
internal sizing to try to accommodate this many threads.
IllegalArgumentException - if the initial capacity is negative or the load factor or concurrencyLevel are
nonpositive.
public ConcurrentIdentityHashMap(int initialCapacity,
float loadFactor)
initialCapacity - The implementation performs internal sizing to accommodate this many elements.loadFactor - the load factor threshold, used to control resizing. Resizing may be performed when the average
number of elements per bin exceeds this threshold.
IllegalArgumentException - if the initial capacity of elements is negative or the load factor is
nonpositivepublic ConcurrentIdentityHashMap(int initialCapacity)
initialCapacity - the initial capacity. The implementation performs internal sizing to accommodate this many
elements.
IllegalArgumentException - if the initial capacity of elements is negative.public ConcurrentIdentityHashMap()
public ConcurrentIdentityHashMap(Map<? extends K,? extends V> m)
m - the map| Method Detail |
|---|
public boolean isEmpty()
isEmpty in interface Map<K,V>isEmpty in class AbstractMap<K,V>public int size()
size in interface Map<K,V>size in class AbstractMap<K,V>public V get(Object key)
null if this map contains no mapping for the
key.
More formally, if this map contains a mapping from a key k to a value v such that
key.equals(k), then this method returns v; otherwise it returns null. (There can be at
most one such mapping.)
get in interface Map<K,V>get in class AbstractMap<K,V>NullPointerException - if the specified key is nullpublic boolean containsKey(Object key)
containsKey in interface Map<K,V>containsKey in class AbstractMap<K,V>key - possible key
NullPointerException - if the specified key is nullpublic boolean containsValue(Object value)
containsValue in interface Map<K,V>containsValue in class AbstractMap<K,V>value - value whose presence in this map is to be tested
NullPointerException - if the specified value is nullpublic boolean contains(Object value)
public V put(K key,
V value)
The value can be retrieved by calling the get method with a key that is equal to the original key.
put in interface Map<K,V>put in class AbstractMap<K,V>key - key with which the specified value is to be associatedvalue - value to be associated with the specified key
NullPointerException - if the specified key or value is null
public V putIfAbsent(K key,
V value)
putIfAbsent in interface ConcurrentMap<K,V>NullPointerException - if the specified key or value is nullpublic final void putAll(Map<? extends K,? extends V> m)
putAll in interface Map<K,V>putAll in class AbstractMap<K,V>m - mappings to be stored in this mappublic V remove(Object key)
remove in interface Map<K,V>remove in class AbstractMap<K,V>key - the key that needs to be removed
NullPointerException - if the specified key is null
public boolean remove(Object key,
Object value)
remove in interface ConcurrentMap<K,V>NullPointerException - if the specified key is null
public boolean replace(K key,
V oldValue,
V newValue)
replace in interface ConcurrentMap<K,V>NullPointerException - if any of the arguments are null
public V replace(K key,
V value)
replace in interface ConcurrentMap<K,V>NullPointerException - if the specified key or value is nullpublic void clear()
clear in interface Map<K,V>clear in class AbstractMap<K,V>public Set<K> keySet()
keySet in interface Map<K,V>keySet in class AbstractMap<K,V>public Collection<V> values()
values in interface Map<K,V>values in class AbstractMap<K,V>public Set<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>entrySet in class AbstractMap<K,V>public Enumeration<K> keys()
keySet()public Enumeration<V> elements()
values()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||