public class CopyOnWriteIdentityMap<K,V> extends Object implements Map<K,V>
Note: This class uses identity for key and value comparison, not equals.
Constructor and Description |
---|
CopyOnWriteIdentityMap()
Creates an empty map.
|
CopyOnWriteIdentityMap(CopyOnWriteIdentityMap<? extends K,? extends V> source)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all entries from the map.
|
boolean |
containsKey(Object key)
Check if the map contains the specified key.
|
boolean |
containsValue(Object value)
Check if the map contains the specified value.
|
Set<Map.Entry<K,V>> |
entrySet()
Returns a snapshot of the entries in this map.
|
V |
get(Object key)
Return the value object for the specified key.
|
boolean |
isEmpty()
Is the map empty?
|
Set<K> |
keySet()
Returns a snapshot of the keys in this map.
|
V |
put(K key,
V value)
Add a key, value pair to the map.
|
<L extends K> |
putAll(L[] keys)
Add all the keys from the specified array to this map with the value
null . |
void |
putAll(Map<? extends K,? extends V> source)
Add all the entries from the specified map to this map.
|
V |
remove(Object key)
Remove a key from the map and returns the value associated with the key.
|
int |
size()
Return the number of entries in the map.
|
Collection<V> |
values()
Returns a snapshot of the values in this map.
|
public CopyOnWriteIdentityMap()
public CopyOnWriteIdentityMap(CopyOnWriteIdentityMap<? extends K,? extends V> source)
source
- The CopyOnWriteMap to copy.public V put(K key, V value)
put
in interface Map<K,V>
key
- The key object to be added to the list.value
- The value object to be associated with the key.
This may be null.null
if the specified key was newly added to the map.
Otherwise the previous value of the key.IllegalArgumentException
- If key is null.public void putAll(Map<? extends K,? extends V> source)
public <L extends K> void putAll(L[] keys)
null
.keys
- The array of keys to be added to this map.public V remove(Object key)
remove
in interface Map<K,V>
key
- The key object to be removed from the map.null
if the key was not in the list.
Otherwise, the value associated with the key.IllegalArgumentException
- If key is null.public void clear()
public boolean isEmpty()
public int size()
public V get(Object key)
get
in interface Map<K,V>
key
- The key object.IllegalArgumentException
- If key is null.public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
key
- The key object.true
if the specified key is in the map.IllegalArgumentException
- If key is null.public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
value
- The value object.true
if the specified value is in the map.public Set<Map.Entry<K,V>> entrySet()
public Set<K> keySet()
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.