K
- The key type for the mapV
- The value type for the mappublic class DelegatingMap<K,V> extends LinkedHashMap<K,V>
In order to support predictable iteration ordering, this extends LinkedHashMap with a modified definition of canonical ordering based on the canonical ordering of non-shadowed keys in the delegate followed by local keys in insertion order (e.g. LinkedHashMap).
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
DelegatingMap()
Constructor.
|
DelegatingMap(Map<K,V> nextMap)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes are not allowed: Delegating Map should be changed in a put-only fashion.
|
void |
clearLocal()
Clear the local map.
|
boolean |
containsKey(Object key) |
boolean |
containsValue(Object o) |
Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object o)
Are these two delegating maps the same in terms of the current layer and their delegates are equal under the
definition of equality for that delegate.
|
LinkedHashMap<K,V> |
flatView()
Return a non delegating map which snapshots the data visible in this delegating map, disconnected from changes
to this and the underlying delegates.
|
V |
get(Object key) |
int |
hashCode() |
Set<K> |
keySet() |
V |
put(K key,
V value)
Adds the key and value to the local map, potentially overshadowing a version in the delegate map.
|
V |
remove(Object o)
Delegating map should be changed in a put-only fashion.
|
V |
removeLocal(K key)
Remove from the local map.
|
int |
size() |
Collection<V> |
values() |
forEach, getOrDefault, removeEldestEntry, replaceAll
clone, compute, computeIfAbsent, computeIfPresent, isEmpty, merge, putAll, putIfAbsent, remove, replace, replace
toString
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, isEmpty, merge, putAll, putIfAbsent, remove, replace, replace
public DelegatingMap()
Uses a LinkedHashMap as it's base map.
public void clear()
public void clearLocal()
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
containsKey
in class HashMap<K,V>
public boolean containsValue(Object o)
containsValue
in interface Map<K,V>
containsValue
in class LinkedHashMap<K,V>
public V put(K key, V value)
public V remove(Object o)
public V removeLocal(K key)
key
- key whose mapping is to be removed from the mappublic int size()
public Collection<V> values()
public LinkedHashMap<K,V> flatView()
public int hashCode()
public boolean equals(Object o)
Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.