Class NullMap<K,V>
java.lang.Object
com.twelvemonkeys.util.NullMap<K,V>
- All Implemented Interfaces:
Serializable, Map<K,V>
An (immutable) empty
Map, that supports all Map operations
without throwing exceptions (in contrast to Collections.EMPTY_MAP
that will throw exceptions on put/remove).
NOTE: This is not a general purpose Map implementation,
as the put and putAll methods will not modify the map.
Instances of this class will always be an empty map.
- Version:
- $Id: com/twelvemonkeys/util/NullMap.java#2 $
- See Also:
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclear()final booleancontainsKey(Object pKey) final booleancontainsValue(Object pValue) entrySet()booleanTests the given object for equality (wether it is also an emptyMap).final VinthashCode()Returns thehashCodeof the empty map,0.final booleanisEmpty()keySet()final Vfinal voidfinal Vfinal intsize()final Collection<V> values()Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
NullMap
public NullMap()
-
-
Method Details
-
size
-
clear
-
isEmpty
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
values
-
putAll
-
entrySet
-
keySet
-
get
-
remove
-
put
-
equals
Tests the given object for equality (wether it is also an emptyMap). This is consistent with the standardMapimplementations of the Java Collections Framework. -
hashCode
-