Class AbstractDecoratedMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
com.twelvemonkeys.util.AbstractDecoratedMap<K,V>
- All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>
- Direct Known Subclasses:
IgnoreCaseMap, LinkedMap, TimeoutMap
abstract class AbstractDecoratedMap<K,V>
extends AbstractMap<K,V>
implements Map<K,V>, Serializable, Cloneable
AbstractDecoratedMap
- Version:
- $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/util/AbstractDecoratedMap.java#2 $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classA simple Map.Entry implementation.protected classprotected classprotected classNested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates aMapbacked by aHashMap.AbstractDecoratedMap(Map<? extends K, ? extends V> pContents) Creates aMapbacked by aHashMap, containing all key/value mappings from the givenMap.Creates aMapbacked by the given backing-Map, containing all key/value mappings from the given contents-Map. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()protected Objectclone()Returns a shallow copy of thisAbstractMapinstance: the keys and values themselves are not cloned.booleancontainsKey(Object pKey) booleancontainsValue(Object pValue) Returnstrueif this map maps one or more keys to the specified pValue.createEntry(K pKey, V pValue) entrySet()abstract Vprotected voidinit()Default implementation, does nothing.booleanisEmpty()keySet()abstract Vabstract VremoveEntry(Map.Entry<K, V> pEntry) Removes the given entry from the Map.intsize()values()Methods inherited from class AbstractMap
equals, hashCode, putAll, toStringMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
entries
-
modCount
protected transient volatile int modCount -
entrySet
-
keySet
-
values
-
-
Constructor Details
-
AbstractDecoratedMap
public AbstractDecoratedMap()Creates aMapbacked by aHashMap. -
AbstractDecoratedMap
Creates aMapbacked by aHashMap, containing all key/value mappings from the givenMap.This is constructor is here to comply with the reccomendations for "standard" constructors in the
Mapinterface.- Parameters:
pContents- the map whose mappings are to be placed in this map. May benull.- See Also:
-
AbstractDecoratedMap
public AbstractDecoratedMap(Map<K, Map.Entry<K, V>> pBacking, Map<? extends K, ? extends V> pContents) Creates aMapbacked by the given backing-Map, containing all key/value mappings from the given contents-Map.NOTE: The backing map is structuraly cahnged, and it should NOT be accessed directly, after the wrapped map is created.
- Parameters:
pBacking- the backing map of this map. Must be either empty, or the same map aspContents.pContents- the map whose mappings are to be placed in this map. May benull.- Throws:
IllegalArgumentException- ifpBackingisnullor ifpBackingdiffers frompContentand is not empty.
-
-
Method Details
-
init
protected void init()Default implementation, does nothing. -
size
-
clear
-
isEmpty
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractMap<K,V>
-
containsValue
Returnstrueif this map maps one or more keys to the specified pValue. More formally, returnstrueif and only if this map contains at least one mapping to a pValuevsuch that(pValue==null ? v==null : pValue.equals(v)).This implementation requires time linear in the map size for this operation.
- Specified by:
containsValuein interfaceMap<K,V> - Overrides:
containsValuein classAbstractMap<K,V> - Parameters:
pValue- pValue whose presence in this map is to be tested.- Returns:
trueif this map maps one or more keys to the specified pValue.
-
values
-
entrySet
-
keySet
-
clone
Returns a shallow copy of thisAbstractMapinstance: the keys and values themselves are not cloned.- Overrides:
clonein classAbstractMap<K,V> - Returns:
- a shallow copy of this map.
- Throws:
CloneNotSupportedException
-
newKeyIterator
-
newValueIterator
-
newEntryIterator
-
get
-
remove
-
put
-
createEntry
-
getEntry
-
removeEntry
-