Package com.google.common.collect
Class RegularImmutableBiMap<K,V>
java.lang.Object
com.google.common.collect.ImmutableMap<K,V>
com.google.common.collect.ImmutableBiMap<K,V>
com.google.common.collect.RegularImmutableBiMap<K,V>
- All Implemented Interfaces:
BiMap<K,
,V> Serializable
,Map<K,
V>
Bimap with zero or more mappings.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final class
private static class
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
FieldsModifier and TypeFieldDescription(package private) static final RegularImmutableBiMap
<Object, Object> private final int
private ImmutableBiMap
<V, K> private final ImmutableMapEntry<K,
V>[] private final int
(package private) static final double
private final ImmutableMapEntry<K,
V>[] Fields inherited from class com.google.common.collect.ImmutableMap
EMPTY_ENTRY_ARRAY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
RegularImmutableBiMap
(ImmutableMapEntry<K, V>[] keyTable, ImmutableMapEntry<K, V>[] valueTable, Map.Entry<K, V>[] entries, int mask, int hashCode) -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
checkNoConflictInValueBucket
(Object value, Map.Entry<?, ?> entry, ImmutableMapEntry<?, ?> valueBucketHead) (package private) ImmutableSet
<Map.Entry<K, V>> (package private) ImmutableSet
<K> void
forEach
(BiConsumer<? super K, ? super V> action) (package private) static <K,
V> ImmutableBiMap <K, V> fromEntries
(Map.Entry<K, V>... entries) (package private) static <K,
V> ImmutableBiMap <K, V> fromEntryArray
(int n, Map.Entry<K, V>[] entryArray) int
hashCode()
inverse()
Returns the inverse view of this bimap, which maps each of this bimap's values to its associated key.(package private) boolean
(package private) boolean
int
size()
(package private) Object
Returns a serializable form of this object.Methods inherited from class com.google.common.collect.ImmutableBiMap
builder, builderWithExpectedSize, copyOf, copyOf, createValues, forcePut, of, of, of, of, of, of, of, of, of, of, of, ofEntries, toImmutableBiMap, toImmutableMap, toImmutableMap, values
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
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, getOrDefault, isEmpty, keySet, merge, putIfAbsent, remove, remove, replace, replace, replaceAll
-
Field Details
-
EMPTY
-
MAX_LOAD_FACTOR
static final double MAX_LOAD_FACTOR- See Also:
-
keyTable
-
valueTable
-
entries
-
mask
private final transient int mask -
hashCode
private final transient int hashCode -
inverse
-
-
Constructor Details
-
RegularImmutableBiMap
private RegularImmutableBiMap(@CheckForNull ImmutableMapEntry<K, V>[] keyTable, @CheckForNull ImmutableMapEntry<K, V>[] valueTable, Map.Entry<K, V>[] entries, int mask, int hashCode)
-
-
Method Details
-
fromEntries
-
fromEntryArray
-
checkNoConflictInValueBucket
private static void checkNoConflictInValueBucket(Object value, Map.Entry<?, ?> entry, @CheckForNull ImmutableMapEntry<?, throws RegularImmutableMap.BucketOverflowException?> valueBucketHead) - Throws:
IllegalArgumentException
- if another entry in the bucket has the same keyRegularImmutableMap.BucketOverflowException
- if this bucket has too many entries, which may indicate a hash flooding attack
-
get
-
createEntrySet
ImmutableSet<Map.Entry<K,V>> createEntrySet()- Specified by:
createEntrySet
in classImmutableMap<K,
V>
-
createKeySet
ImmutableSet<K> createKeySet()- Specified by:
createKeySet
in classImmutableMap<K,
V>
-
forEach
-
isHashCodeFast
boolean isHashCodeFast()- Overrides:
isHashCodeFast
in classImmutableMap<K,
V>
-
hashCode
public int hashCode() -
isPartialView
boolean isPartialView()- Specified by:
isPartialView
in classImmutableMap<K,
V>
-
size
public int size() -
inverse
Description copied from class:ImmutableBiMap
Returns 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
ImmutableBiMap
is anotherImmutableBiMap
. -
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 classImmutableBiMap<K,
V>
-