Class BidirectionalMap<K,​V>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<K,​V>

    public class BidirectionalMap<K,​V>
    extends java.util.HashMap<K,​V>
    A bidirectional map is a map that preserves the uniqueness of its values as well as that of its keys.
    Author:
    jumperchen
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      boolean equals​(java.lang.Object o)  
      K getKey​(V value)
      Returns the key from the given value.
      int hashCode()  
      V put​(K key, V value)  
      V remove​(java.lang.Object key)  
      • Methods inherited from class java.util.HashMap

        clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, values
      • Methods inherited from class java.util.AbstractMap

        toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BidirectionalMap

        public BidirectionalMap​(int i,
                                float v)
      • BidirectionalMap

        public BidirectionalMap​(int i)
      • BidirectionalMap

        public BidirectionalMap()
      • BidirectionalMap

        public BidirectionalMap​(java.util.Map<? extends K,​? extends V> map)
    • Method Detail

      • getKey

        public K getKey​(V value)
        Returns the key from the given value.
      • remove

        public V remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map<K,​V>
        Overrides:
        remove in class java.util.HashMap<K,​V>
      • put

        public V put​(K key,
                     V value)
        Specified by:
        put in interface java.util.Map<K,​V>
        Overrides:
        put in class java.util.HashMap<K,​V>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map<K,​V>
        Overrides:
        clear in class java.util.HashMap<K,​V>
      • equals

        public boolean equals​(java.lang.Object o)
        Specified by:
        equals in interface java.util.Map<K,​V>
        Overrides:
        equals in class java.util.AbstractMap<K,​V>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Map<K,​V>
        Overrides:
        hashCode in class java.util.AbstractMap<K,​V>