Defines a map that allows bidirectional lookup between key and values.
This extended Map
represents a mapping where a key may lookup a value and a value may lookup a key with equal ease. This interface extends Map
and so may be used anywhere a map is required. The interface provides an inverse map view, enabling full access to both directions of the BidiMap
.
Implementations should allow a value to be looked up from a key and a key to be looked up from a value with equal performance.
This map enforces the restriction that there is a 1:1 relation between keys and values, meaning that multiple keys cannot map to the same value. This is required so that "inverting" the map results in a map without duplicate keys. See the {@link #put} method description for more information.
@param < K> the type of the keys in the map
@param < V> the type of the values in the map
@since 3.0
@version $Id: BidiMap.java 1477779 2013-04-30 18:55:24Z tn $