Package com.google.common.collect
Class RegularImmutableBiMap<K,V>
- java.lang.Object
-
- com.google.common.collect.ImmutableMap<K,V>
-
- com.google.common.collect.ImmutableBiMapFauxverideShim<K,V>
-
- com.google.common.collect.ImmutableBiMap<K,V>
-
- com.google.common.collect.RegularImmutableBiMap<K,V>
-
- All Implemented Interfaces:
BiMap<K,V>,java.io.Serializable,java.util.Map<K,V>
class RegularImmutableBiMap<K,V> extends ImmutableBiMap<K,V>
Bimap with zero or more mappings.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classRegularImmutableBiMap.Inverseprivate static classRegularImmutableBiMap.InverseSerializedForm<K,V>-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableBiMap
ImmutableBiMap.Builder<K,V>
-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableMap
ImmutableMap.IteratorBasedImmutableMap<K,V>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static RegularImmutableBiMap<java.lang.Object,java.lang.Object>EMPTY(package private) java.util.Map.Entry<K,V>[]entriesprivate inthashCodeprivate ImmutableBiMap<V,K>inverseprivate ImmutableMapEntry<K,V>[]keyTableprivate intmask(package private) static doubleMAX_LOAD_FACTORprivate ImmutableMapEntry<K,V>[]valueTable-
Fields inherited from class com.google.common.collect.ImmutableMap
EMPTY_ENTRY_ARRAY
-
-
Constructor Summary
Constructors Modifier Constructor Description privateRegularImmutableBiMap(ImmutableMapEntry<K,V>[] keyTable, ImmutableMapEntry<K,V>[] valueTable, java.util.Map.Entry<K,V>[] entries, int mask, int hashCode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static intcheckNoConflictInValueBucket(java.lang.Object value, java.util.Map.Entry<?,?> entry, ImmutableMapEntry<?,?> valueBucketHead)(package private) ImmutableSet<java.util.Map.Entry<K,V>>createEntrySet()(package private) ImmutableSet<K>createKeySet()voidforEach(java.util.function.BiConsumer<? super K,? super V> action)(package private) static <K,V>
ImmutableBiMap<K,V>fromEntries(java.util.Map.Entry<K,V>... entries)(package private) static <K,V>
ImmutableBiMap<K,V>fromEntryArray(int n, java.util.Map.Entry<K,V>[] entryArray)Vget(java.lang.Object key)inthashCode()ImmutableBiMap<V,K>inverse()Returns the inverse view of this bimap, which maps each of this bimap's values to its associated key.(package private) booleanisHashCodeFast()(package private) booleanisPartialView()intsize()-
Methods inherited from class com.google.common.collect.ImmutableBiMap
builder, builderWithExpectedSize, copyOf, copyOf, createValues, forcePut, of, of, of, of, of, of, toImmutableBiMap, values, writeReplace
-
Methods inherited from class com.google.common.collect.ImmutableBiMapFauxverideShim
toImmutableMap, toImmutableMap
-
Methods inherited from class com.google.common.collect.ImmutableMap
asMultimap, checkNoConflict, clear, compute, computeIfAbsent, computeIfPresent, conflictException, containsKey, containsValue, entryOf, entrySet, equals, getOrDefault, isEmpty, keyIterator, keySet, keySpliterator, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, toString
-
-
-
-
Field Detail
-
EMPTY
static final RegularImmutableBiMap<java.lang.Object,java.lang.Object> EMPTY
-
MAX_LOAD_FACTOR
static final double MAX_LOAD_FACTOR
- See Also:
- Constant Field Values
-
keyTable
private final transient ImmutableMapEntry<K,V>[] keyTable
-
valueTable
private final transient ImmutableMapEntry<K,V>[] valueTable
-
mask
private final transient int mask
-
hashCode
private final transient int hashCode
-
inverse
private transient ImmutableBiMap<V,K> inverse
-
-
Constructor Detail
-
RegularImmutableBiMap
private RegularImmutableBiMap(ImmutableMapEntry<K,V>[] keyTable, ImmutableMapEntry<K,V>[] valueTable, java.util.Map.Entry<K,V>[] entries, int mask, int hashCode)
-
-
Method Detail
-
fromEntries
static <K,V> ImmutableBiMap<K,V> fromEntries(java.util.Map.Entry<K,V>... entries)
-
fromEntryArray
static <K,V> ImmutableBiMap<K,V> fromEntryArray(int n, java.util.Map.Entry<K,V>[] entryArray)
-
checkNoConflictInValueBucket
private static int checkNoConflictInValueBucket(java.lang.Object value, java.util.Map.Entry<?,?> entry, ImmutableMapEntry<?,?> valueBucketHead)- Returns:
- number of entries in this bucket
- Throws:
java.lang.IllegalArgumentException- if another entry in the bucket has the same key
-
get
public V get(java.lang.Object key)
-
createEntrySet
ImmutableSet<java.util.Map.Entry<K,V>> createEntrySet()
- Specified by:
createEntrySetin classImmutableMap<K,V>
-
createKeySet
ImmutableSet<K> createKeySet()
- Specified by:
createKeySetin classImmutableMap<K,V>
-
isHashCodeFast
boolean isHashCodeFast()
- Overrides:
isHashCodeFastin classImmutableMap<K,V>
-
hashCode
public int hashCode()
-
isPartialView
boolean isPartialView()
- Specified by:
isPartialViewin classImmutableMap<K,V>
-
size
public int size()
-
inverse
public ImmutableBiMap<V,K> inverse()
Description copied from class:ImmutableBiMapReturns the inverse view of this bimap, which maps each of this bimap's values to its associated key. The two bimaps are backed by the same data; any changes to one will appear in the other.Note:There is no guaranteed correspondence between the iteration order of a bimap and that of its inverse.
The inverse of an
ImmutableBiMapis anotherImmutableBiMap.
-
-