Class AbstractMapDecorator
- java.lang.Object
-
- org.apache.commons.collections.map.AbstractMapDecorator
-
- All Implemented Interfaces:
Map
- Direct Known Subclasses:
AbstractBidiMapDecorator,AbstractOrderedMapDecorator,AbstractSortedMapDecorator,DefaultedMap,FixedSizeMap,LazyMap,ListOrderedMap,MultiValueMap,PredicatedMap,TransformedMap,UnmodifiableMap
public abstract class AbstractMapDecorator extends Object implements Map
Provides a base decorator that enables additional functionality to be added to a Map via decoration.Methods are forwarded directly to the decorated map.
This implementation does not perform any special processing with
entrySet(),keySet()orvalues(). Instead it simply returns the set/collection from the wrapped map. This may be undesirable, for example if you are trying to write a validating implementation it would provide a loophole around the validation. But, you might want that loophole, so this class is kept simple.- Since:
- Commons Collections 3.0
- Version:
- $Revision: 646777 $ $Date: 2008-04-10 14:33:15 +0200 (Thu, 10 Apr 2008) $
- Author:
- Daniel Rall, Stephen Colebourne
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMapDecorator()Constructor only used in deserialization, do not use otherwise.AbstractMapDecorator(Map map)Constructor that wraps (not copies).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)SetentrySet()booleanequals(Object object)Objectget(Object key)protected MapgetMap()Gets the map being decorated.inthashCode()booleanisEmpty()SetkeySet()Objectput(Object key, Object value)voidputAll(Map mapToCopy)Objectremove(Object key)intsize()StringtoString()Collectionvalues()-
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
-
-
-
-
Field Detail
-
map
protected transient Map map
The map to decorate
-
-
Constructor Detail
-
AbstractMapDecorator
protected AbstractMapDecorator()
Constructor only used in deserialization, do not use otherwise.- Since:
- Commons Collections 3.1
-
AbstractMapDecorator
public AbstractMapDecorator(Map map)
Constructor that wraps (not copies).- Parameters:
map- the map to decorate, must not be null- Throws:
IllegalArgumentException- if the collection is null
-
-
Method Detail
-
getMap
protected Map getMap()
Gets the map being decorated.- Returns:
- the decorated map
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap
-
values
public Collection values()
-
equals
public boolean equals(Object object)
-
hashCode
public int hashCode()
-
-