|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.mina.util.CopyOnWriteMap<K,V>
public class CopyOnWriteMap<K,V>
A thread-safe version of Map
in which all operations that change the
Map are implemented by making a new copy of the underlying Map.
While the creation of a new Map can be expensive, this class is designed for
cases in which the primary function is to read data from the Map, not to
modify the Map. Therefore the operations that do not cause a change to this
class happen quickly and concurrently.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Constructor Summary | |
---|---|
CopyOnWriteMap()
Creates a new instance of CopyOnWriteMap. |
|
CopyOnWriteMap(int initialCapacity)
Creates a new instance of CopyOnWriteMap with the specified initial size |
|
CopyOnWriteMap(Map<K,V> data)
Creates a new instance of CopyOnWriteMap in which the initial data being held by this map is contained in the supplied map. |
Method Summary | |
---|---|
void |
clear()
Removes all entries in this map. |
Object |
clone()
|
boolean |
containsKey(Object key)
Returns true if this map contains the provided key, otherwise this method return false. |
boolean |
containsValue(Object value)
Returns true if this map contains the provided value, otherwise this method returns false. |
Set<Map.Entry<K,V>> |
entrySet()
This method will return a read-only Set . |
V |
get(Object key)
Returns the value associated with the provided key from this map. |
boolean |
isEmpty()
Returns true if this map is empty, otherwise false. |
Set<K> |
keySet()
This method will return a read-only Set . |
V |
put(K key,
V value)
Adds the provided key and value to this map. |
void |
putAll(Map<? extends K,? extends V> newData)
Inserts all the keys and values contained in the provided map to this map. |
V |
remove(Object key)
Removed the value and key from this map based on the provided key. |
int |
size()
Returns the number of key/value pairs in this map. |
Collection<V> |
values()
This method will return a read-only Collection . |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Constructor Detail |
---|
public CopyOnWriteMap()
public CopyOnWriteMap(int initialCapacity)
initialCapacity
- The initial size of the Map.public CopyOnWriteMap(Map<K,V> data)
data
- A Map containing the initial contents to be placed into
this class.Method Detail |
---|
public V put(K key, V value)
put
in interface Map<K,V>
Map.put(java.lang.Object, java.lang.Object)
public V remove(Object key)
remove
in interface Map<K,V>
Map.remove(java.lang.Object)
public void putAll(Map<? extends K,? extends V> newData)
putAll
in interface Map<K,V>
Map.putAll(java.util.Map)
public void clear()
clear
in interface Map<K,V>
Map.clear()
public int size()
size
in interface Map<K,V>
Map.size()
public boolean isEmpty()
isEmpty
in interface Map<K,V>
Map.isEmpty()
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
Map.containsKey(java.lang.Object)
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
Map.containsValue(java.lang.Object)
public V get(Object key)
get
in interface Map<K,V>
Map.get(java.lang.Object)
public Set<K> keySet()
Set
.
keySet
in interface Map<K,V>
public Collection<V> values()
Collection
.
values
in interface Map<K,V>
public Set<Map.Entry<K,V>> entrySet()
Set
.
entrySet
in interface Map<K,V>
public Object clone()
clone
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |