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:
java.io.Serializable
,java.util.Map<K,V>
final class JdkBackedImmutableMap<K,V> extends ImmutableMap<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
Fields Modifier and Type Field Description private java.util.Map<K,V>
delegateMap
private ImmutableList<java.util.Map.Entry<K,V>>
entries
-
Fields inherited from class com.google.common.collect.ImmutableMap
EMPTY_ENTRY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description JdkBackedImmutableMap(java.util.Map<K,V> delegateMap, ImmutableList<java.util.Map.Entry<K,V>> entries)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static <K,V>
ImmutableMap<K,V>create(int n, java.util.Map.Entry<K,V>[] entryArray)
Creates anImmutableMap
backed by a JDK HashMap.(package private) ImmutableSet<java.util.Map.Entry<K,V>>
createEntrySet()
(package private) ImmutableSet<K>
createKeySet()
(package private) ImmutableCollection<V>
createValues()
void
forEach(java.util.function.BiConsumer<? super K,? super V> action)
V
get(java.lang.Object key)
(package private) boolean
isPartialView()
int
size()
-
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, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, toImmutableMap, toImmutableMap, toString, values, writeReplace
-
-
-
-
Field Detail
-
entries
private final transient ImmutableList<java.util.Map.Entry<K,V>> entries
-
-
Constructor Detail
-
JdkBackedImmutableMap
JdkBackedImmutableMap(java.util.Map<K,V> delegateMap, ImmutableList<java.util.Map.Entry<K,V>> entries)
-
-
Method Detail
-
create
static <K,V> ImmutableMap<K,V> create(int n, java.util.Map.Entry<K,V>[] entryArray)
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
public V get(java.lang.Object key)
-
createEntrySet
ImmutableSet<java.util.Map.Entry<K,V>> createEntrySet()
- Specified by:
createEntrySet
in classImmutableMap<K,V>
-
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>
-
-