Package com.google.common.collect
Class WellBehavedMap<K,V>
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- com.google.common.collect.ForwardingMap<K,V>
-
- com.google.common.collect.WellBehavedMap<K,V>
-
- All Implemented Interfaces:
java.util.Map<K,V>
@GwtCompatible final class WellBehavedMap<K,V> extends ForwardingMap<K,V>
Workaround for EnumMap bug. If you want to pass anEnumMap
, with the intention of using itsentrySet()
method, you should wrap theEnumMap
in this class instead.This class is not thread-safe even if the underlying map is.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
WellBehavedMap.EntrySet
-
Nested classes/interfaces inherited from class com.google.common.collect.ForwardingMap
ForwardingMap.StandardEntrySet, ForwardingMap.StandardKeySet, ForwardingMap.StandardValues
-
-
Constructor Summary
Constructors Modifier Constructor Description private
WellBehavedMap(java.util.Map<K,V> delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 aWellBehavedEntriesMap
, which intercepts itsentrySet()
method by taking theSet<K> keySet()
and transforming it toSet<Entry<K, V>>
.-
Methods inherited from class com.google.common.collect.ForwardingMap
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, standardClear, standardContainsKey, standardContainsValue, standardEquals, standardHashCode, standardIsEmpty, standardPutAll, standardRemove, standardToString, values
-
Methods inherited from class com.google.common.collect.ForwardingObject
toString
-
-
-
-
Method Detail
-
wrap
static <K,V> WellBehavedMap<K,V> wrap(java.util.Map<K,V> delegate)
Wraps the given map into aWellBehavedEntriesMap
, which intercepts itsentrySet()
method by taking theSet<K> keySet()
and transforming it toSet<Entry<K, V>>
. All other invocations are delegated as-is.
-
delegate
protected java.util.Map<K,V> delegate()
Description copied from class:ForwardingObject
Returns the backing delegate instance that methods are forwarded to. Abstract subclasses generally override this method with an abstract method that has a more specific return type, such asForwardingSet.delegate()
. Concrete subclasses override this method to supply the instance being decorated.- Specified by:
delegate
in classForwardingMap<K,V>
-
-