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