Interface ReverseMap<K,V>

Type Parameters:
K - The type of map key.
V - The type of map value.
All Superinterfaces:
Map<K,V>
All Known Subinterfaces:
ReadWriteLockReverseMap<K,V>
All Known Implementing Classes:
DecoratorReadWriteLockReverseMap, DecoratorReverseMap

public interface ReverseMap<K,V> extends Map<K,V>
A map that also allows lookup of the map keys keyed to the values.

The keys and values in this map have a one-to-one relationship. Associating multiple values with a key will likely result in errant functionality.

Author:
Garret Wilson
  • Method Details

    • getKey

      K getKey(V value)
      Returns the key that represents the given value.
      Parameters:
      value - The value whose associated key is to be returned.
      Returns:
      The key to which this map reverse maps the specified value, or null if the map contains no reverse mapping for this value.
      Throws:
      ClassCastException - Thrown if the value is of an inappropriate type for this map (optional).
      NullPointerException - Thrown if the value is null and this map does not not permit null values (optional).
      See Also:
    • removeValue

      K removeValue(V value)
      Removes the mapping for a value from this map if it is present.
      Parameters:
      value - The value whose mapping is to be removed from the map.
      Returns:
      The previous key associated with the value, or null if there was no mapping for the value.
      Throws:
      UnsupportedOperationException - if the remove operation is not supported by this map
      ClassCastException - if the value is of an inappropriate type for this map (optional).
      NullPointerException - if the specified value is null and this map does not permit null values (optional).