public abstract class CopyOnWriteMap<K,V> extends Object implements Map<K,V>
Map
that has copy-on-write semantics.
This class is suitable where highly concurrent access is needed, yet the write operation is relatively uncommon.
Modifier and Type | Class and Description |
---|---|
static class |
CopyOnWriteMap.Hash<K,V>
CopyOnWriteMap backed by HashMap . |
static class |
CopyOnWriteMap.Tree<K,V>
CopyOnWriteMap backed by TreeMap . |
Modifier | Constructor and Description |
---|---|
protected |
CopyOnWriteMap() |
protected |
CopyOnWriteMap(Map<K,V> core) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
protected abstract Map<K,V> |
copy() |
Set<Map.Entry<K,V>> |
entrySet()
This method will return a read-only
Set . |
boolean |
equals(Object obj) |
V |
get(Object key) |
int |
hashCode() |
boolean |
isEmpty() |
Set<K> |
keySet()
This method will return a read-only
Set . |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> t) |
V |
remove(Object key) |
void |
replaceBy(Map<? extends K,? extends V> data)
Atomically replaces the entire map by the copy of the specified map.
|
int |
size() |
String |
toString() |
protected void |
update(Map<K,V> m) |
Collection<V> |
values()
This method will return a read-only
Collection . |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public void replaceBy(Map<? extends K,? extends V> data)
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
public Collection<V> values()
Collection
.public int hashCode()
public boolean equals(Object obj)
Copyright © 2004–2022. All rights reserved.