K
- The type of key.V
- The type of value.public class MapDecorator<K,V> extends Object implements Map<K,V>
Modifier and Type | Field and Description |
---|---|
protected Map<K,V> |
map
The map wrapped by this decorator.
|
Constructor and Description |
---|
MapDecorator(Map<K,V> map)
Constructs a new map decorator, wrapping the specified map.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all of the mappings from the map.
|
boolean |
containsKey(Object key)
Returns
true if this map contains a mapping for the specified
key. |
boolean |
containsValue(Object value)
Returns
true if the map maps one or more keys to the specified
value. |
Set<Map.Entry<K,V>> |
entrySet()
Returns a
Set view of the mappings contained in the map. |
boolean |
equals(Object o)
Compares the specified object with the map for equality.
|
V |
get(Object key)
Returns the value to which the specified key is mapped, or
null
if the map contains no mapping for the key. |
int |
hashCode()
Returns the hash code value for the map.
|
boolean |
isEmpty()
Returns
true if the map contains no key-value mappings. |
Set<K> |
keySet()
Returns a
Set view of the keys contained in the map. |
V |
put(K key,
V value)
Associates the specified value with the specified key in the map.
|
void |
putAll(Map<? extends K,? extends V> m)
Copies all of the mappings from the specified map to the map.
|
V |
remove(Object key)
Removes the mapping for a key from the map if it is present.
|
int |
size()
Returns the number of key-value mappings in this map.
|
Collection<V> |
values()
Returns a
Collection view of the values contained in the map. |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public MapDecorator(Map<K,V> map)
map
- the map to wrap with the decorator.NullPointerException
- if map
is null
.public int size()
public boolean isEmpty()
true
if the map contains no key-value mappings.public boolean containsKey(Object key)
true
if this map contains a mapping for the specified
key.containsKey
in interface Map<K,V>
key
- the key whose presence in this map is to be tested.true
if this map contains a mapping for the specified
key.public boolean containsValue(Object value)
true
if the map maps one or more keys to the specified
value.containsValue
in interface Map<K,V>
value
- the value whose presence in the map is to be tested.true
if the map maps one or more keys to the specified
value.public V get(Object key)
null
if the map contains no mapping for the key.public void putAll(Map<? extends K,? extends V> m)
public void clear()
public Collection<V> values()
Collection
view of the values contained in the map.public Set<Map.Entry<K,V>> entrySet()
Set
view of the mappings contained in the map.public int hashCode()
Copyright © 2010-2018, ForgeRock All Rights Reserved.