Top Description Inners Fields Constructors Methods
com.google.common.collect

pack-priv Class RegularImmutableBiMap<K, V>

extends ImmutableBiMap<K, V>
Class Inheritance
Annotations
@GwtCompatible
serializable:true
emulated:true
@SuppressWarnings:serial
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkNotNull, .Preconditions.checkPositionIndex, com.google.common.collect.CollectPreconditions.checkEntryNotNull, .ImmutableMapEntry.createEntryArray, .RegularImmutableMap.MAX_HASH_BUCKET_LENGTH, .RegularImmutableMap.checkNoConflictInKeyBucket, java.util.Objects.requireNonNull

Bimap with zero or more mappings.
Author
Louis Wasserman

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private static class

Field Summary

Modifier and TypeField and Description
pack-priv static final RegularImmutableBiMap<Object, Object>
pack-priv final transient Map.Entry<K, V>[]
private final transient int
private transient ImmutableBiMap<V, K>
private final transient @Nullable ImmutableMapEntry<K, V>[]
private final transient int
pack-priv static final double
private final transient @Nullable ImmutableMapEntry<K, V>[]

Constructor Summary

AccessConstructor and Description
private
RegularImmutableBiMap(@Nullable ImmutableMapEntry<K, V>[] keyTable, @Nullable ImmutableMapEntry<K, V>[] valueTable, Map.Entry<K, V>[] entries, int mask, int hashCode)

Method Summary

Modifier and TypeMethod and Description
private static void
checkNoConflictInValueBucket(Object value, Map.Entry<?, ?> entry, ImmutableMapEntry<?, ?> valueBucketHead)

pack-priv ImmutableSet<Map.Entry<K, V>>
pack-priv ImmutableSet<K>
public void
forEach(BiConsumer<? super K, ? super V>
The action to be performed for each entry
action
)

Overrides default java.util.Map.forEach.

Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
pack-priv static <K, V> ImmutableBiMap<K, V>
fromEntries(Map.Entry<K, V>... entries)

pack-priv static <K, V> ImmutableBiMap<K, V>
fromEntryArray(int n, @Nullable Map.Entry<K, V>[] entryArray)

public V
get(Object
the key whose associated value is to be returned
key
)

Implements abstract com.google.common.collect.ImmutableMap.get.

Implements java.util.Map.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
public int
hashCode()

Overrides com.google.common.collect.ImmutableMap.hashCode.

Implements java.util.Map.hashCode.

Returns the hash code value for this map.
public ImmutableBiMap<V, K>
inverse()

Implements abstract com.google.common.collect.ImmutableBiMap.inverse.

Implements com.google.common.collect.BiMap.inverse.

Returns the inverse view of this bimap, which maps each of this bimap's values to its associated key.
pack-priv boolean
pack-priv boolean
public int
size()

Implements java.util.Map.size.

Returns the number of key-value mappings in this map.
pack-priv Object
writeReplace()

Overrides com.google.common.collect.ImmutableBiMap.writeReplace.

Returns a serializable form of this object.
Inherited from com.google.common.collect.ImmutableBiMap:
builderbuilderWithExpectedSizecopyOfcopyOfcreateValuesforcePutofofofofofofofofofofofofEntriestoImmutableBiMaptoImmutableMaptoImmutableMapvalues

Field Detail

EMPTYback to summary
pack-priv static final RegularImmutableBiMap<Object, Object> EMPTY
Annotations
@SuppressWarnings:unchecked
entriesback to summary
pack-priv final transient Map.Entry<K, V>[] entries
Annotations
@VisibleForTesting
hashCodeback to summary
private final transient int hashCode
inverseback to summary
private transient ImmutableBiMap<V, K> inverse
Annotations
@LazyInit
@RetainedWith
@CheckForNull
keyTableback to summary
private final transient @Nullable ImmutableMapEntry<K, V>[] keyTable
Annotations
@CheckForNull
maskback to summary
private final transient int mask
MAX_LOAD_FACTORback to summary
pack-priv static final double MAX_LOAD_FACTOR
valueTableback to summary
private final transient @Nullable ImmutableMapEntry<K, V>[] valueTable
Annotations
@CheckForNull

Constructor Detail

RegularImmutableBiMapback to summary
private RegularImmutableBiMap(@Nullable ImmutableMapEntry<K, V>[] keyTable, @Nullable ImmutableMapEntry<K, V>[] valueTable, Map.Entry<K, V>[] entries, int mask, int hashCode)

Method Detail

checkNoConflictInValueBucketback to summary
private static void checkNoConflictInValueBucket(Object value, Map.Entry<?, ?> entry, ImmutableMapEntry<?, ?> valueBucketHead) throws BucketOverflowException
Exceptions
BucketOverflowException:
if this bucket has too many entries, which may indicate a hash flooding attack
IllegalArgumentException:
if another entry in the bucket has the same key
createEntrySetback to summary
pack-priv ImmutableSet<Map.Entry<K, V>> createEntrySet()

Implements abstract com.google.common.collect.ImmutableMap.createEntrySet.

Annotations
@Override
createKeySetback to summary
pack-priv ImmutableSet<K> createKeySet()

Implements abstract com.google.common.collect.ImmutableMap.createKeySet.

Annotations
@Override
forEachback to summary
public void forEach(BiConsumer<? super K, ? super V> action)

Overrides default java.util.Map.forEach.

Doc from java.util.Map.forEach.

Performs the given action for each entry in this map until all entries have been processed or the action throws an exception. Unless otherwise specified by the implementing class, actions are performed in the order of entry set iteration (if an iteration order is specified.) Exceptions thrown by the action are relayed to the caller.

Parameters
action:BiConsumer<? super K, ? super V>

The action to be performed for each entry

Annotations
@Override
fromEntriesback to summary
pack-priv static <K, V> ImmutableBiMap<K, V> fromEntries(Map.Entry<K, V>... entries)
fromEntryArrayback to summary
pack-priv static <K, V> ImmutableBiMap<K, V> fromEntryArray(int n, @Nullable Map.Entry<K, V>[] entryArray)
getback to summary
public V get(Object key)

Implements abstract com.google.common.collect.ImmutableMap.get.

Implements java.util.Map.get.

Doc from java.util.Map.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

More formally, if this map contains a mapping from a key k to a value v such that Objects.equals(key, k), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

If this map permits null values, then a return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

Parameters
key:Object

the key whose associated value is to be returned

Returns:V

the value to which the specified key is mapped, or null if this map contains no mapping for the key

Annotations
@Override
@CheckForNull
hashCodeback to summary
public int hashCode()

Overrides com.google.common.collect.ImmutableMap.hashCode.

Implements java.util.Map.hashCode.

Doc from java.util.Map.hashCode.

Returns the hash code value for this map. The hash code of a map is defined to be the sum of the hash codes of each entry in the map's entrySet() view. This ensures that m1.equals(m2) implies that m1.hashCode()==m2.hashCode() for any two maps m1 and m2, as required by the general contract of Object#hashCode.

Returns:int

the hash code value for this map

Annotations
@Override
inverseback to summary
public ImmutableBiMap<V, K> inverse()

Implements abstract com.google.common.collect.ImmutableBiMap.inverse.

Implements com.google.common.collect.BiMap.inverse.

Doc from com.google.common.collect.ImmutableBiMap.inverse.

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 another ImmutableBiMap.

Returns:ImmutableBiMap<V, K>

Doc from com.google.common.collect.BiMap.inverse.

the inverse view of this bimap

Annotations
@Override
isHashCodeFastback to summary
pack-priv boolean isHashCodeFast()

Overrides com.google.common.collect.ImmutableMap.isHashCodeFast.

Annotations
@Override
isPartialViewback to summary
pack-priv boolean isPartialView()

Implements abstract com.google.common.collect.ImmutableMap.isPartialView.

Annotations
@Override
sizeback to summary
public int size()

Implements java.util.Map.size.

Doc from java.util.Map.size.

Returns the number of key-value mappings in this map. If the map contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of key-value mappings in this map

Annotations
@Override
writeReplaceback to summary
pack-priv Object writeReplace()

Overrides com.google.common.collect.ImmutableBiMap.writeReplace.

Doc from com.google.common.collect.ImmutableMap.writeReplace.

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.

Annotations
@SuppressWarnings:RedundantOverride
@Override
@J2ktIncompatible
@GwtIncompatible
com.google.common.collect back to summary

private final Class RegularImmutableBiMap.Inverse

extends ImmutableBiMap<V, K>
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv ImmutableSet<Map.Entry<V, K>>
pack-priv ImmutableSet<V>
public void
forEach(BiConsumer<? super V, ? super K>
The action to be performed for each entry
action
)

Overrides default java.util.Map.forEach.

Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
public K
get(Object
the key whose associated value is to be returned
value
)

Implements abstract com.google.common.collect.ImmutableMap.get.

Implements java.util.Map.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
public ImmutableBiMap<K, V>
inverse()

Implements abstract com.google.common.collect.ImmutableBiMap.inverse.

Implements com.google.common.collect.BiMap.inverse.

Returns the inverse view of this bimap, which maps each of this bimap's values to its associated key.
pack-priv boolean
private void
public int
size()

Implements java.util.Map.size.

Returns the number of key-value mappings in this map.
pack-priv Object
writeReplace()

Overrides com.google.common.collect.ImmutableBiMap.writeReplace.

Returns a serializable form of this object.
Inherited from com.google.common.collect.ImmutableBiMap:
builderbuilderWithExpectedSizecopyOfcopyOfcreateValuesforcePutofofofofofofofofofofofofEntriestoImmutableBiMaptoImmutableMaptoImmutableMapvalues

Constructor Detail

Inverseback to summary
private Inverse()

Method Detail

createEntrySetback to summary
pack-priv ImmutableSet<Map.Entry<V, K>> createEntrySet()

Implements abstract com.google.common.collect.ImmutableMap.createEntrySet.

Annotations
@Override
createKeySetback to summary
pack-priv ImmutableSet<V> createKeySet()

Implements abstract com.google.common.collect.ImmutableMap.createKeySet.

Annotations
@Override
forEachback to summary
public void forEach(BiConsumer<? super V, ? super K> action)

Overrides default java.util.Map.forEach.

Doc from java.util.Map.forEach.

Performs the given action for each entry in this map until all entries have been processed or the action throws an exception. Unless otherwise specified by the implementing class, actions are performed in the order of entry set iteration (if an iteration order is specified.) Exceptions thrown by the action are relayed to the caller.

Parameters
action:BiConsumer<? super V, ? super K>

The action to be performed for each entry

Annotations
@Override
getback to summary
public K get(Object value)

Implements abstract com.google.common.collect.ImmutableMap.get.

Implements java.util.Map.get.

Doc from java.util.Map.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

More formally, if this map contains a mapping from a key k to a value v such that Objects.equals(key, k), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

If this map permits null values, then a return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

Parameters
value:Object

the key whose associated value is to be returned

Returns:K

the value to which the specified key is mapped, or null if this map contains no mapping for the key

Annotations
@Override
@CheckForNull
inverseback to summary
public ImmutableBiMap<K, V> inverse()

Implements abstract com.google.common.collect.ImmutableBiMap.inverse.

Implements com.google.common.collect.BiMap.inverse.

Doc from com.google.common.collect.ImmutableBiMap.inverse.

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 another ImmutableBiMap.

Returns:ImmutableBiMap<K, V>

Doc from com.google.common.collect.BiMap.inverse.

the inverse view of this bimap

Annotations
@Override
isPartialViewback to summary
pack-priv boolean isPartialView()

Implements abstract com.google.common.collect.ImmutableMap.isPartialView.

Annotations
@Override
readObjectback to summary
private void readObject(ObjectInputStream stream) throws InvalidObjectException

Hides com.google.common.collect.ImmutableBiMap.readObject.

Annotations
@J2ktIncompatible
sizeback to summary
public int size()

Implements java.util.Map.size.

Doc from java.util.Map.size.

Returns the number of key-value mappings in this map. If the map contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of key-value mappings in this map

Annotations
@Override
writeReplaceback to summary
pack-priv Object writeReplace()

Overrides com.google.common.collect.ImmutableBiMap.writeReplace.

Doc from com.google.common.collect.ImmutableMap.writeReplace.

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.

Annotations
@Override
@J2ktIncompatible
@GwtIncompatible
com.google.common.collect back to summary

pack-priv final Class RegularImmutableBiMap.Inverse.InverseEntrySet

extends ImmutableMapEntrySet<V, K>
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv ImmutableList<Map.Entry<V, K>>
public void
forEach(Consumer<? super Map.Entry<V, K>>
The action to be performed for each element
action
)

Overrides default java.lang.Iterable.forEach.

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.
public int
pack-priv boolean
isHashCodeFast()

Overrides com.google.common.collect.ImmutableMapEntrySet.isHashCodeFast.

Returns true if the hashCode() method runs quickly.
public UnmodifiableIterator<Map.Entry<V, K>>
iterator()

Implements abstract com.google.common.collect.ImmutableSet.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this set.
pack-priv ImmutableMap<V, K>
pack-priv Object
Inherited from com.google.common.collect.ImmutableMapEntrySet:
containsisPartialViewsize

Constructor Detail

InverseEntrySetback to summary
pack-priv InverseEntrySet()

Method Detail

createAsListback to summary
pack-priv ImmutableList<Map.Entry<V, K>> createAsList()

Overrides com.google.common.collect.ImmutableSet.CachingAsList.createAsList.

Annotations
@Override
forEachback to summary
public void forEach(Consumer<? super Map.Entry<V, K>> action)

Overrides default java.lang.Iterable.forEach.

Doc from java.lang.Iterable.forEach.

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.

The behavior of this method is unspecified if the action performs side-effects that modify the underlying source of elements, unless an overriding class has specified a concurrent modification policy.

Parameters
action:Consumer<? super Map.Entry<V, K>>

The action to be performed for each element

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides com.google.common.collect.ImmutableMapEntrySet.hashCode.

Implements java.util.Set.hashCode, java.util.Collection.hashCode.

Doc from java.util.Set.hashCode.

Returns the hash code value for this set. The hash code of a set is defined to be the sum of the hash codes of the elements in the set, where the hash code of a null element is defined to be zero. This ensures that s1.equals(s2) implies that s1.hashCode()==s2.hashCode() for any two sets s1 and s2, as required by the general contract of Object#hashCode.

Returns:int

the hash code value for this set

Annotations
@Override
isHashCodeFastback to summary
pack-priv boolean isHashCodeFast()

Overrides com.google.common.collect.ImmutableMapEntrySet.isHashCodeFast.

Doc from com.google.common.collect.ImmutableSet.isHashCodeFast.

Returns true if the hashCode() method runs quickly.

Annotations
@Override
iteratorback to summary
public UnmodifiableIterator<Map.Entry<V, K>> iterator()

Implements abstract com.google.common.collect.ImmutableSet.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.Set.iterator.

Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).

Returns:UnmodifiableIterator<Map.Entry<V, K>>

an iterator over the elements in this set

Annotations
@Override
mapback to summary
pack-priv ImmutableMap<V, K> map()

Implements abstract com.google.common.collect.ImmutableMapEntrySet.map.

Annotations
@Override
writeReplaceback to summary
pack-priv Object writeReplace()

Overrides com.google.common.collect.ImmutableMapEntrySet.writeReplace.

Annotations
@SuppressWarnings:RedundantOverride
@Override
@J2ktIncompatible
@GwtIncompatible
com.google.common.collect back to summary

private Class RegularImmutableBiMap.InverseSerializedForm<K, V>

extends Object
implements Serializable
Class Inheritance
  • java.lang.Object
  • com.google.common.collect.RegularImmutableBiMap.InverseSerializedForm
All Implemented Interfaces
java.io.Serializable
Annotations
@J2ktIncompatible

Field Summary

Modifier and TypeField and Description
private final ImmutableBiMap<K, V>
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

forwardback to summary
private final ImmutableBiMap<K, V> forward
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

InverseSerializedFormback to summary
pack-priv InverseSerializedForm(ImmutableBiMap<K, V> forward)

Method Detail

readResolveback to summary
pack-priv Object readResolve()