Package com.google.common.collect
Class JdkBackedImmutableBiMap<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.JdkBackedImmutableBiMap<K,V>
-
- All Implemented Interfaces:
BiMap<K,V>,java.io.Serializable,java.util.Map<K,V>
final class JdkBackedImmutableBiMap<K,V> extends ImmutableBiMap<K,V>
Implementation of ImmutableBiMap backed by a pair of JDK HashMaps, which have smartness protecting against hash flooding.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classJdkBackedImmutableBiMap.InverseEntries-
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 private java.util.Map<V,K>backwardDelegateprivate ImmutableList<java.util.Map.Entry<K,V>>entriesprivate java.util.Map<K,V>forwardDelegateprivate JdkBackedImmutableBiMap<V,K>inverse-
Fields inherited from class com.google.common.collect.ImmutableMap
EMPTY_ENTRY_ARRAY
-
-
Constructor Summary
Constructors Modifier Constructor Description privateJdkBackedImmutableBiMap(ImmutableList<java.util.Map.Entry<K,V>> entries, java.util.Map<K,V> forwardDelegate, java.util.Map<V,K> backwardDelegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static <K,V>
ImmutableBiMap<K,V>create(int n, java.util.Map.Entry<K,V>[] entryArray)(package private) ImmutableSet<java.util.Map.Entry<K,V>>createEntrySet()(package private) ImmutableSet<K>createKeySet()Vget(java.lang.Object key)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) 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, hashCode, isEmpty, isHashCodeFast, keyIterator, keySet, keySpliterator, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, toString
-
-
-
-
Field Detail
-
entries
private final transient ImmutableList<java.util.Map.Entry<K,V>> entries
-
inverse
private transient JdkBackedImmutableBiMap<V,K> inverse
-
-
Method Detail
-
create
static <K,V> ImmutableBiMap<K,V> create(int n, java.util.Map.Entry<K,V>[] entryArray)
-
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.
-
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>
-
isPartialView
boolean isPartialView()
- Specified by:
isPartialViewin classImmutableMap<K,V>
-
-