final class SingletonImmutableBiMap<K,V> extends ImmutableBiMap<K,V>
ImmutableMap
with exactly one entry.ImmutableBiMap.Builder<K,V>
ImmutableMap.IteratorBasedImmutableMap<K,V>
Modifier and Type | Field and Description |
---|---|
private ImmutableBiMap<V,K> |
inverse |
private ImmutableBiMap<V,K> |
lazyInverse |
(package private) K |
singleKey |
(package private) V |
singleValue |
EMPTY_ENTRY_ARRAY
Modifier | Constructor and Description |
---|---|
(package private) |
SingletonImmutableBiMap(K singleKey,
V singleValue) |
private |
SingletonImmutableBiMap(K singleKey,
V singleValue,
ImmutableBiMap<V,K> inverse) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
(package private) ImmutableSet<java.util.Map.Entry<K,V>> |
createEntrySet() |
(package private) ImmutableSet<K> |
createKeySet() |
void |
forEach(java.util.function.BiConsumer<? super K,? super V> action) |
V |
get(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) boolean |
isPartialView() |
int |
size() |
builder, builderWithExpectedSize, copyOf, copyOf, createValues, forcePut, of, of, of, of, of, of, toImmutableBiMap, values, writeReplace
toImmutableMap, toImmutableMap
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, toString
final transient K singleKey
final transient V singleValue
private final transient ImmutableBiMap<V,K> inverse
private transient ImmutableBiMap<V,K> lazyInverse
private SingletonImmutableBiMap(K singleKey, V singleValue, ImmutableBiMap<V,K> inverse)
public V get(java.lang.Object key)
public int size()
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<K,V>
containsKey
in class ImmutableMap<K,V>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<K,V>
containsValue
in class ImmutableMap<K,V>
boolean isPartialView()
isPartialView
in class ImmutableMap<K,V>
ImmutableSet<java.util.Map.Entry<K,V>> createEntrySet()
createEntrySet
in class ImmutableMap<K,V>
ImmutableSet<K> createKeySet()
createKeySet
in class ImmutableMap<K,V>
public ImmutableBiMap<V,K> inverse()
ImmutableBiMap
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
.