|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.CopyOnWriteMap
public class CopyOnWriteMap
A thread-safe variant of Map
in which all mutating operations (e.g. put
, putAll
) are implemented by making a fresh copy of the underlying map.
Iterators over this map are guaranteed to produce a safe-iteration and not to throw ConcurrentModificationException
. The iterator will not reflect concurrent additions, removals, or changes to this map. Mutating operations on iterators themselves (e.g. remove
, setValue
) are not supported (and will throw UnsupportedOperationException
).
Note: mutations on this map are costly, but may be more efficient than alternatives when "get" operations vastly outnumber mutations. All mutating operations are synchronized, so concurrent mutation can be prevented by holding synchronization on this object.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry |
Constructor Summary | |
---|---|
CopyOnWriteMap(java.lang.Class clazz) |
|
CopyOnWriteMap(java.util.Map map) Construct a CopyOnWriteMap, initialized with the contents of the specified map. |
Method Summary | |
---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object oKey) |
boolean |
containsValue(java.lang.Object oValue) |
protected java.util.Map |
copyMap(java.util.Map map) Create an instance of Map based on the contents of the provided map. |
java.util.Set |
entrySet() |
boolean |
equals(java.lang.Object o) |
java.lang.Object |
get(java.lang.Object oKey) |
protected java.util.Map |
getInternalMap() Return the internal map. |
int |
hashCode() |
protected java.util.Map |
instantiateMap(java.lang.Class clazz) Create a new instance of Map based on the provided Class . |
boolean |
isEmpty() |
java.util.Set |
keySet() |
java.lang.Object |
put(java.lang.Object oKey, java.lang.Object oValue) |
void |
putAll(java.util.Map map) |
java.lang.Object |
remove(java.lang.Object oKey) |
protected void |
setInternalMap(java.util.Map map) Set the internal map. |
int |
size() |
java.lang.String |
toString() |
java.util.Collection |
values() |
Constructor Detail |
---|
public CopyOnWriteMap(java.lang.Class clazz)
public CopyOnWriteMap(java.util.Map map)
map
- the initial mapMethod Detail |
---|
protected java.util.Map getInternalMap()
protected void setInternalMap(java.util.Map map)
map
- the new internal mapprotected java.util.Map instantiateMap(java.lang.Class clazz)
Map
based on the provided Class
.clazz
- the type of Map
to instantiateMap
java.lang.IllegalArgumentException
- if the provided Class
does not implement Map
.protected java.util.Map copyMap(java.util.Map map)
Map
based on the contents of the provided map.map
- the map to copyMap
populated with the contents of the provided mappublic int size()
size
in interface java.util.Map
public boolean isEmpty()
isEmpty
in interface java.util.Map
public boolean containsKey(java.lang.Object oKey)
containsKey
in interface java.util.Map
public boolean containsValue(java.lang.Object oValue)
containsValue
in interface java.util.Map
public java.lang.Object get(java.lang.Object oKey)
get
in interface java.util.Map
public java.lang.Object put(java.lang.Object oKey, java.lang.Object oValue)
put
in interface java.util.Map
public java.lang.Object remove(java.lang.Object oKey)
remove
in interface java.util.Map
public void putAll(java.util.Map map)
putAll
in interface java.util.Map
public void clear()
clear
in interface java.util.Map
public java.util.Set keySet()
keySet
in interface java.util.Map
public java.util.Collection values()
values
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
public boolean equals(java.lang.Object o)
equals
in interface java.util.Map
public int hashCode()
hashCode
in interface java.util.Map
public java.lang.String toString()
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |