Package com.google.common.collect
Class RegularImmutableMap<K,V>
- java.lang.Object
-
- com.google.common.collect.ImmutableMap<K,V>
-
- com.google.common.collect.RegularImmutableMap<K,V>
-
- All Implemented Interfaces:
java.io.Serializable,java.util.Map<K,V>
@GwtCompatible(serializable=true, emulated=true) final class RegularImmutableMap<K,V> extends ImmutableMap<K,V>
Implementation ofImmutableMapwith two or more entries.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classRegularImmutableMap.KeySet<K,V>private static classRegularImmutableMap.Values<K,V>-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableMap
ImmutableMap.Builder<K,V>, ImmutableMap.IteratorBasedImmutableMap<K,V>, ImmutableMap.SerializedForm
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map.Entry<K,V>[]entriesprivate intmaskprivate static doubleMAX_LOAD_FACTORClosed addressing tends to perform well even with high load factors.private static longserialVersionUIDprivate ImmutableMapEntry<K,V>[]table-
Fields inherited from class com.google.common.collect.ImmutableMap
EMPTY_ENTRY_ARRAY
-
-
Constructor Summary
Constructors Modifier Constructor Description privateRegularImmutableMap(java.util.Map.Entry<K,V>[] entries, ImmutableMapEntry<K,V>[] table, int mask)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static voidcheckNoConflictInKeyBucket(java.lang.Object key, java.util.Map.Entry<?,?> entry, ImmutableMapEntry<?,?> keyBucketHead)(package private) ImmutableSet<java.util.Map.Entry<K,V>>createEntrySet()(package private) ImmutableSet<K>createKeySet()(package private) ImmutableCollection<V>createValues()(package private) static <K,V>
RegularImmutableMap<K,V>fromEntries(java.util.Map.Entry<K,V>... entries)(package private) static <K,V>
RegularImmutableMap<K,V>fromEntryArray(int n, java.util.Map.Entry<K,V>[] entryArray)Creates a RegularImmutableMap from the first n entries in entryArray.Vget(java.lang.Object key)(package private) static <V> Vget(java.lang.Object key, ImmutableMapEntry<?,V>[] keyTable, int mask)(package private) booleanisPartialView()intsize()-
Methods inherited from class com.google.common.collect.ImmutableMap
asMultimap, builder, checkNoConflict, clear, containsKey, containsValue, copyOf, copyOf, entryOf, entrySet, equals, hashCode, isEmpty, isHashCodeFast, keyIterator, keySet, of, of, of, of, of, of, put, putAll, remove, toString, values, writeReplace
-
-
-
-
Field Detail
-
table
private final transient ImmutableMapEntry<K,V>[] table
-
mask
private final transient int mask
-
MAX_LOAD_FACTOR
private static final double MAX_LOAD_FACTOR
Closed addressing tends to perform well even with high load factors. Being conservative here ensures that the table is still likely to be relatively sparse (hence it misses fast) while saving space.- See Also:
- Constant Field Values
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RegularImmutableMap
private RegularImmutableMap(java.util.Map.Entry<K,V>[] entries, ImmutableMapEntry<K,V>[] table, int mask)
-
-
Method Detail
-
fromEntries
static <K,V> RegularImmutableMap<K,V> fromEntries(java.util.Map.Entry<K,V>... entries)
-
fromEntryArray
static <K,V> RegularImmutableMap<K,V> fromEntryArray(int n, java.util.Map.Entry<K,V>[] entryArray)
Creates a RegularImmutableMap from the first n entries in entryArray. This implementation may replace the entries in entryArray with its own entry objects (though they will have the same key/value contents), and may take ownership of entryArray.
-
checkNoConflictInKeyBucket
static void checkNoConflictInKeyBucket(java.lang.Object key, java.util.Map.Entry<?,?> entry, @Nullable ImmutableMapEntry<?,?> keyBucketHead)
-
get
public V get(@Nullable java.lang.Object key)
-
get
@Nullable static <V> V get(@Nullable java.lang.Object key, ImmutableMapEntry<?,V>[] keyTable, int mask)
-
size
public int size()
-
isPartialView
boolean isPartialView()
- Specified by:
isPartialViewin classImmutableMap<K,V>
-
createEntrySet
ImmutableSet<java.util.Map.Entry<K,V>> createEntrySet()
- Specified by:
createEntrySetin classImmutableMap<K,V>
-
createKeySet
ImmutableSet<K> createKeySet()
- Overrides:
createKeySetin classImmutableMap<K,V>
-
createValues
ImmutableCollection<V> createValues()
- Overrides:
createValuesin classImmutableMap<K,V>
-
-