Package hudson.util
Class CopyOnWriteMap<K,V>
- java.lang.Object
-
- hudson.util.CopyOnWriteMap<K,V>
-
- All Implemented Interfaces:
Map<K,V>
- Direct Known Subclasses:
CopyOnWriteMap.Hash,CopyOnWriteMap.Tree
public abstract class CopyOnWriteMap<K,V> extends Object implements Map<K,V>
Mapthat has copy-on-write semantics.This class is suitable where highly concurrent access is needed, yet the write operation is relatively uncommon.
- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCopyOnWriteMap.Hash<K,V>CopyOnWriteMapbacked byHashMap.static classCopyOnWriteMap.Tree<K,V>CopyOnWriteMapbacked byTreeMap.
-
Constructor Summary
Constructors Modifier Constructor Description protectedCopyOnWriteMap()protectedCopyOnWriteMap(Map<K,V> core)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)protected abstract Map<K,V>copy()Set<Map.Entry<K,V>>entrySet()This method will return a read-onlySet.booleanequals(Object obj)Vget(Object key)inthashCode()booleanisEmpty()Set<K>keySet()This method will return a read-onlySet.Vput(K key, V value)voidputAll(Map<? extends K,? extends V> t)Vremove(Object key)voidreplaceBy(Map<? extends K,? extends V> data)Atomically replaces the entire map by the copy of the specified map.intsize()StringtoString()protected voidupdate(Map<K,V> m)Collection<V>values()This method will return a read-onlyCollection.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Method Detail
-
replaceBy
public void replaceBy(Map<? extends K,? extends V> data)
Atomically replaces the entire map by the copy of the specified map.
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<K,V>
-
values
public Collection<V> values()
This method will return a read-onlyCollection.
-
hashCode
public int hashCode()
-
equals
public boolean equals(Object obj)
-
-