Class ReverseHashMap<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
de.florianmichael.rclasses.pattern.ReverseHashMap<K,V>
Type Parameters:
K - The key type.
V - The value type.
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>

public class ReverseHashMap<K,V> extends LinkedHashMap<K,V>
Implementation of a reverse hash map. This map is able to get the key of a given value.
See Also:
  • Constructor Details

    • ReverseHashMap

      public ReverseHashMap()
  • Method Details

    • put

      public V put(K key, V value)
      Puts a key and a value into the map. The value will be also put into the reversed map.
      Specified by:
      put in interface Map<K,V>
      Overrides:
      put in class HashMap<K,V>
      Parameters:
      key - The key.
      value - The value.
      Returns:
      The value.
    • getKey

      public K getKey(V value)
      Parameters:
      value - The value.
      Returns:
      The key of the given value.