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

pack-priv abstract Class AbstractBiMap<K extends @Nullable Object, V extends @Nullable Object>

extends ForwardingMap<K extends @Nullable Object, V extends @Nullable Object>
implements BiMap<K extends @Nullable Object, V extends @Nullable Object>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, com.google.common.collect.BiMap, java.util.Map
Known Direct Subclasses
com.google.common.collect.AbstractBiMap.Inverse, com.google.common.collect.EnumBiMap, com.google.common.collect.EnumHashBiMap
Annotations
@GwtCompatible
emulated:true
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkArgument, .Preconditions.checkState, com.google.common.collect.NullnessCasts.uncheckedCastNullableTToT

A general-purpose bimap implementation using any two backing Map instances.

Note that this class contains equals() calls that keep it from supporting IdentityHashMap backing maps.

Authors
Kevin Bourrillion, Mike Bostock

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
private class
pack-priv static class
AbstractBiMap.Inverse<K extends @Nullable Object, V extends @Nullable Object>

The inverse of any other AbstractBiMap subclass.

private class
private class

Field Summary

Modifier and TypeField and Description
private transient Map<K, V>
private transient Set<Map.Entry<K, V>>
pack-priv transient AbstractBiMap<V, K>
private transient Set<K>
private static final long
private transient Set<V>

Constructor Summary

AccessConstructor and Description
pack-priv
AbstractBiMap(Map<K, V> forward, Map<V, K> backward)

Package-private constructor for creating a map-backed bimap.

private
AbstractBiMap(Map<K, V> backward, AbstractBiMap<V, K> forward)

Private constructor for inverse bimap.

Method Summary

Modifier and TypeMethod and Description
pack-priv K
checkKey(K key)

Returns its input, or throws an exception if this is not a valid key.

pack-priv V
checkValue(V value)

Returns its input, or throws an exception if this is not a valid value.

public void
clear()

Overrides com.google.common.collect.ForwardingMap.clear.

Implements java.util.Map.clear.

Removes all of the mappings from this map (optional operation).
public boolean
containsValue(Object
value whose presence in this map is to be tested
value
)

Overrides com.google.common.collect.ForwardingMap.containsValue.

Implements java.util.Map.containsValue.

Returns true if this map maps one or more keys to the specified value.
protected Map<K, V>
delegate()

Implements abstract com.google.common.collect.ForwardingMap.delegate.

Returns the backing delegate instance that methods are forwarded to.
public Set<Map.Entry<K, V>>
entrySet()

Overrides com.google.common.collect.ForwardingMap.entrySet.

Implements java.util.Map.entrySet.

Returns a Set view of the mappings contained in this map.
pack-priv Iterator<Map.Entry<K, V>>
public V
forcePut(K
the key with which the specified value is to be associated
key
,
V
the value to be associated with the specified key
value
)

Implements com.google.common.collect.BiMap.forcePut.

An alternate form of put that silently removes any existing entry with the value value before proceeding with the put operation.
public BiMap<V, K>
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.
public Set<K>
keySet()

Overrides com.google.common.collect.ForwardingMap.keySet.

Implements java.util.Map.keySet.

Returns a Set view of the keys contained in this map.
pack-priv AbstractBiMap<V, K>
makeInverse(Map<V, K> backward)

public V
put(K
key with which the specified value is to be associated
key
,
V
value to be associated with the specified key
value
)

Overrides com.google.common.collect.ForwardingMap.put.

Implements com.google.common.collect.BiMap.put, java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation).
public void
putAll(Map<? extends K, ? extends V>
mappings to be stored in this map
map
)

Overrides com.google.common.collect.ForwardingMap.putAll.

Implements com.google.common.collect.BiMap.putAll, java.util.Map.putAll.

Copies all of the mappings from the specified map to this map (optional operation).
private V
putInBothMaps(K key, V value, boolean force)

public V
remove(Object
key whose mapping is to be removed from the map
key
)

Overrides com.google.common.collect.ForwardingMap.remove.

Implements java.util.Map.remove.

Removes the mapping for a key from this map if it is present (optional operation).
private V
private void
public void
replaceAll(BiFunction<? super K, ? super V, ? extends V>
the function to apply to each entry
function
)

Overrides default java.util.Map.replaceAll.

Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception.
pack-priv void
setDelegates(Map<K, V> forward, Map<V, K> backward)

Specifies the delegate maps going in each direction.

pack-priv void
setInverse(AbstractBiMap<V, K> inverse)

private void
updateInverseMap(K key, boolean containedKey, V oldValue, V newValue)

public Set<V>
values()

Overrides com.google.common.collect.ForwardingMap.values.

Implements com.google.common.collect.BiMap.values, java.util.Map.values.

Returns a Collection view of the values contained in this map.
Inherited from com.google.common.collect.ForwardingMap:
containsKeyequalsgethashCodeisEmptysizestandardClearstandardContainsKeystandardContainsValuestandardEqualsstandardHashCodestandardIsEmptystandardPutAllstandardRemovestandardToString