K
- the type of the keys in the mapV
- the type of the values in the mappublic abstract class AbstractMapDecorator<K,V> extends AbstractIterableMap<K,V>
Methods are forwarded directly to the decorated map.
This implementation does not perform any special processing with
entrySet()
, keySet()
or values()
. Instead
it simply returns the set/collection from the wrapped map. This may be
undesirable, for example if you are trying to write a validating
implementation it would provide a loophole around the validation.
But, you might want that loophole, so this class is kept simple.
Modifier | Constructor and Description |
---|---|
protected |
AbstractMapDecorator()
Constructor only used in deserialization, do not use otherwise.
|
protected |
AbstractMapDecorator(Map<K,V> map)
Constructor that wraps (not copies).
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
protected Map<K,V> |
decorated()
Gets the map being decorated.
|
Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object object) |
V |
get(Object key) |
int |
hashCode() |
boolean |
isEmpty() |
Set<K> |
keySet() |
V |
put(K key,
V value)
Note that the return type is Object, rather than V as in the Map interface.
|
void |
putAll(Map<? extends K,? extends V> mapToCopy) |
V |
remove(Object key) |
int |
size() |
String |
toString() |
Collection<V> |
values() |
mapIterator
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
protected AbstractMapDecorator()
protected AbstractMapDecorator(Map<K,V> map)
map
- the map to decorate, must not be nullNullPointerException
- if the map is nullpublic void clear()
Map.clear()
public boolean containsKey(Object key)
public boolean containsValue(Object value)
public boolean isEmpty()
public V put(K key, V value)
IterableMap
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keykey
, or
null
if there was no mapping for key
.
(A null
return can also indicate that the map
previously associated null
with key
,
if the implementation supports null
values.)Map.put(Object, Object)
public void putAll(Map<? extends K,? extends V> mapToCopy)
mapToCopy
- mappings to be stored in this mapMap.putAll(Map)
public int size()
public Collection<V> values()
public boolean equals(Object object)
public int hashCode()
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.