|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.faunos.util.AbstractCopyOnWriteMap<K,V,M>
public abstract class AbstractCopyOnWriteMap<K,V,M extends Map<K,V>>
Base class for copy-on-write Map or SortedMap mimplementation. The implementation is designed to be suitable for use cases in which updates are very few and reads are many and concurrent.
Initial tests hint that read performance of this implementation may be better than through synchronized access or through a ConcurrentHashMap. But the main take away from the tests was that performance was "good enough" across all implementations.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Field Summary | |
---|---|
protected M |
impl
The internal implementation. |
Constructor Summary | |
---|---|
AbstractCopyOnWriteMap()
|
Method Summary | |
---|---|
void |
clear()
|
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
protected abstract M |
emptyMap()
Returns an implementation-specific empty map. |
Set<Map.Entry<K,V>> |
entrySet()
Returns a read-only, snapshot of this instance's entry set. |
boolean |
equals(Object object)
|
V |
get(Object key)
|
int |
hashCode()
|
boolean |
isEmpty()
|
Set<K> |
keySet()
Returns a read-only, snapshot of this instance's key set. |
protected abstract M |
newMap()
Returns a new implementation-specific empty map. |
V |
put(K key,
V value)
|
void |
putAll(Map<? extends K,? extends V> t)
|
V |
remove(Object key)
|
void |
setMap(Map<? extends K,? extends V> t)
Atomically sets the contents of this map to be equal to the contents of the given map t. |
int |
size()
|
Collection<V> |
values()
Returns a read-only, snapshot of this instance's values. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected volatile M extends Map<K,V> impl
Constructor Detail |
---|
public AbstractCopyOnWriteMap()
Method Detail |
---|
public void clear()
clear
in interface Map<K,V>
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
public Set<Map.Entry<K,V>> entrySet()
entrySet
in interface Map<K,V>
public V get(Object key)
get
in interface Map<K,V>
public boolean isEmpty()
isEmpty
in interface Map<K,V>
public Set<K> keySet()
keySet
in interface Map<K,V>
public V put(K key, V value)
put
in interface Map<K,V>
public void putAll(Map<? extends K,? extends V> t)
putAll
in interface Map<K,V>
public void setMap(Map<? extends K,? extends V> t)
public V remove(Object key)
remove
in interface Map<K,V>
public int size()
size
in interface Map<K,V>
public Collection<V> values()
values
in interface Map<K,V>
public boolean equals(Object object)
equals
in interface Map<K,V>
equals
in class Object
public int hashCode()
hashCode
in interface Map<K,V>
hashCode
in class Object
protected abstract M emptyMap()
protected abstract M newMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |