Serializable, Map<K,V>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 | Description |
|---|---|
NullMap() |
| Modifier and Type | Method | 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() |
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic 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 © 2018. All rights reserved.