Package com.google.common.collect
Class SingletonImmutableBiMap<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.SingletonImmutableBiMap<K,V>
- All Implemented Interfaces:
BiMap<K,,V> Serializable,Map<K,V>
Implementation of
ImmutableMap with exactly one entry.-
Nested Class Summary
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 TypeFieldDescriptionprivate final ImmutableBiMap<V,K> private ImmutableBiMap<V,K> (package private) final K(package private) final VFields inherited from class com.google.common.collect.ImmutableMap
EMPTY_ENTRY_ARRAY -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)SingletonImmutableBiMap(K singleKey, V singleValue) privateSingletonImmutableBiMap(K singleKey, V singleValue, ImmutableBiMap<V, K> inverse) -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(Object key) booleancontainsValue(Object value) (package private) ImmutableSet<Map.Entry<K,V>> (package private) ImmutableSet<K>voidforEach(BiConsumer<? super K, ? super V> action) inverse()Returns the inverse view of this bimap, which maps each of this bimap's values to its associated key.(package private) booleanintsize()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, values, writeReplaceMethods inherited from class com.google.common.collect.ImmutableBiMapFauxverideShim
toImmutableMap, toImmutableMapMethods inherited from class com.google.common.collect.ImmutableMap
asMultimap, checkNoConflict, clear, compute, computeIfAbsent, computeIfPresent, conflictException, entryOf, entrySet, equals, getOrDefault, hashCode, isEmpty, isHashCodeFast, keyIterator, keySet, keySpliterator, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, entrySet, equals, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, remove, replace, replace, replaceAll
-
Field Details
-
singleKey
-
singleValue
-
inverse
-
lazyInverse
-
-
Constructor Details
-
SingletonImmutableBiMap
-
SingletonImmutableBiMap
-
-
Method Details
-
get
-
size
public int size() -
forEach
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classImmutableMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V> - Overrides:
containsValuein classImmutableMap<K,V>
-
isPartialView
boolean isPartialView()- Specified by:
isPartialViewin classImmutableMap<K,V>
-
createEntrySet
ImmutableSet<Map.Entry<K,V>> createEntrySet()- Specified by:
createEntrySetin classImmutableMap<K,V>
-
createKeySet
ImmutableSet<K> createKeySet()- Specified by:
createKeySetin classImmutableMap<K,V>
-
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.
-