public final class NullMap<K,V>
extends java.lang.Object
implements java.util.Map<K,V>, java.io.Serializable
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.| Constructor and Description |
|---|
NullMap() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object pKey) |
boolean |
containsValue(java.lang.Object pValue) |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
boolean |
equals(java.lang.Object pOther)
Tests the given object for equality (wether it is also an empty
Map). |
V |
get(java.lang.Object pKey) |
int |
hashCode()
Returns the
hashCode of the empty map, 0. |
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
V |
put(java.lang.Object pKey,
java.lang.Object pValue) |
void |
putAll(java.util.Map pMap) |
V |
remove(java.lang.Object pKey) |
int |
size() |
java.util.Collection<V> |
values() |
public final boolean containsKey(java.lang.Object pKey)
public final boolean containsValue(java.lang.Object pValue)
public final java.util.Collection<V> values()
public final void putAll(java.util.Map pMap)
public final V remove(java.lang.Object pKey)
public final V put(java.lang.Object pKey, java.lang.Object pValue)
public boolean equals(java.lang.Object pOther)
Map).
This is consistent with the standard Map implementations of the
Java Collections Framework.Copyright © 2018. All Rights Reserved.