Package com.google.common.collect
Class JdkBackedImmutableMap<K,V>
java.lang.Object
com.google.common.collect.ImmutableMap<K,V>
com.google.common.collect.JdkBackedImmutableMap<K,V>
- All Implemented Interfaces:
Serializable
,Map<K,
V>
Implementation of ImmutableMap backed by a JDK HashMap, which has smartness protecting against
hash flooding.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableMap
ImmutableMap.Builder<K,
V>, ImmutableMap.IteratorBasedImmutableMap<K, V>, ImmutableMap.SerializedForm<K, V> -
Field Summary
FieldsFields inherited from class com.google.common.collect.ImmutableMap
EMPTY_ENTRY_ARRAY
-
Constructor Summary
ConstructorsConstructorDescriptionJdkBackedImmutableMap
(Map<K, V> delegateMap, ImmutableList<Map.Entry<K, V>> entries) -
Method Summary
Modifier and TypeMethodDescription(package private) static <K,
V> ImmutableMap <K, V> Creates anImmutableMap
backed by a JDK HashMap.(package private) ImmutableSet
<Map.Entry<K, V>> (package private) ImmutableSet
<K> (package private) ImmutableCollection
<V> void
forEach
(BiConsumer<? super K, ? super V> action) (package private) boolean
int
size()
(package private) Object
Returns a serializable form of this object.Methods inherited from class com.google.common.collect.ImmutableMap
asMultimap, builder, builderWithExpectedSize, checkNoConflict, clear, compute, computeIfAbsent, computeIfPresent, conflictException, containsKey, containsValue, copyOf, copyOf, entryOf, entrySet, equals, getOrDefault, hashCode, isEmpty, isHashCodeFast, keyIterator, keySet, keySpliterator, merge, of, of, of, of, of, of, of, of, of, of, of, ofEntries, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, toImmutableMap, toImmutableMap, toString, values
-
Field Details
-
delegateMap
-
entries
-
-
Constructor Details
-
JdkBackedImmutableMap
-
-
Method Details
-
create
static <K,V> ImmutableMap<K,V> create(int n, Map.Entry<K, V>[] entryArray, boolean throwIfDuplicateKeys) Creates anImmutableMap
backed by a JDK HashMap. Used when probable hash flooding is detected. This implementation may replace the entries in entryArray with its own entry objects (though they will have the same key/value contents), and will take ownership of entryArray. -
size
public int size() -
get
-
createEntrySet
ImmutableSet<Map.Entry<K,V>> createEntrySet()- Specified by:
createEntrySet
in classImmutableMap<K,
V>
-
forEach
-
createKeySet
ImmutableSet<K> createKeySet()- Specified by:
createKeySet
in classImmutableMap<K,
V>
-
createValues
ImmutableCollection<V> createValues()- Specified by:
createValues
in classImmutableMap<K,
V>
-
isPartialView
boolean isPartialView()- Specified by:
isPartialView
in classImmutableMap<K,
V>
-
writeReplace
Object writeReplace()Description copied from class:ImmutableMap
Returns a serializable form of this object. Non-public subclasses should not override this method. Publicly-accessible subclasses must override this method and should return a subclass of SerializedForm whose readResolve() method returns objects of the subclass type.- Overrides:
writeReplace
in classImmutableMap<K,
V>
-