@GwtCompatible final class WellBehavedMap<K,V> extends ForwardingMap<K,V>
EnumMap
, with the
intention of using its entrySet()
method, you should
wrap the EnumMap
in this class instead.
This class is not thread-safe even if the underlying map is.
Modifier and Type | Class and Description |
---|---|
private class |
WellBehavedMap.EntrySet |
ForwardingMap.StandardEntrySet, ForwardingMap.StandardKeySet, ForwardingMap.StandardValues
Modifier and Type | Field and Description |
---|---|
private java.util.Map<K,V> |
delegate |
private java.util.Set<java.util.Map.Entry<K,V>> |
entrySet |
Modifier | Constructor and Description |
---|---|
private |
WellBehavedMap(java.util.Map<K,V> delegate) |
Modifier and Type | Method and Description |
---|---|
protected java.util.Map<K,V> |
delegate()
Returns the backing delegate instance that methods are forwarded to.
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
(package private) static <K,V> WellBehavedMap<K,V> |
wrap(java.util.Map<K,V> delegate)
Wraps the given map into a
WellBehavedEntriesMap , which
intercepts its entrySet() method by taking the
Set<K> keySet() and transforming it to
Set<Entry<K, V>> . |
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, standardClear, standardContainsKey, standardContainsValue, standardEquals, standardHashCode, standardIsEmpty, standardPutAll, standardRemove, standardToString, values
toString
static <K,V> WellBehavedMap<K,V> wrap(java.util.Map<K,V> delegate)
WellBehavedEntriesMap
, which
intercepts its entrySet()
method by taking the
Set<K> keySet()
and transforming it to
Set<Entry<K, V>>
. All other invocations are delegated as-is.protected java.util.Map<K,V> delegate()
ForwardingObject
ForwardingSet.delegate()
. Concrete subclasses override this method to supply
the instance being decorated.delegate
in class ForwardingMap<K,V>