Class BiHashMap<a,​b>

  • Type Parameters:
    a - any datatype for the key
    b - any datatype for the value
    All Implemented Interfaces:
    java.util.Map<a,​b>

    public class BiHashMap<a,​b>
    extends java.lang.Object
    implements java.util.Map<a,​b>
    Bidirectional HashMap utility class
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

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

      Constructors 
      Constructor Description
      BiHashMap()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      get the value for key
      boolean containsKey​(java.lang.Object arg0)  
      boolean containsValue​(java.lang.Object arg0)  
      java.util.Set<java.util.Map.Entry<a,​b>> entrySet()  
      b get​(java.lang.Object arg0)  
      a getKey​(b val)
      get the value for key
      java.util.Iterator<a> getKeyIterator()  
      java.util.Map<a,​b> getKeyMap()
      get a reference to the internal key map
      java.util.Map<b,​a> getValMap()
      get a reference to the internal value map
      b getValue​(a key)
      get the value for key
      boolean isEmpty()  
      java.util.Set<a> keySet()  
      b put​(a key, b val)
      put the value for key
      both key and value must be non-null
      void putAll​(java.util.Map<? extends a,​? extends b> arg0)  
      b remove​(java.lang.Object key)
      remove key and its associated value
      a removeVal​(java.lang.Object value)
      remove value and its associated key
      void setUnique​(boolean b)
      TODO Please insert comment!
      int size()  
      java.lang.String toString()  
      java.util.Collection<b> values()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Constructor Detail

      • BiHashMap

        public BiHashMap()
    • Method Detail

      • getValue

        public b getValue​(a key)
        get the value for key
        Parameters:
        key - the key
        Returns:
        the corresponding value
      • getKeyIterator

        public java.util.Iterator<a> getKeyIterator()
        Returns:
        the corresponding key iterator
      • getKey

        public a getKey​(b val)
        get the value for key
        Parameters:
        val - the value
        Returns:
        the corresponding key
      • remove

        public b remove​(java.lang.Object key)
        remove key and its associated value
        Specified by:
        remove in interface java.util.Map<a,​b>
        Parameters:
        key - the key
        Returns:
      • removeVal

        public a removeVal​(java.lang.Object value)
        remove value and its associated key
        Parameters:
        value - the value
        Returns:
      • put

        public b put​(a key,
                     b val)
        put the value for key
        both key and value must be non-null
        Specified by:
        put in interface java.util.Map<a,​b>
        Parameters:
        key - the key
        val - the value
        Returns:
      • clear

        public void clear()
        get the value for key
        Specified by:
        clear in interface java.util.Map<a,​b>
      • getKeyMap

        public java.util.Map<a,​b> getKeyMap()
        get a reference to the internal key map
        Returns:
      • getValMap

        public java.util.Map<b,​a> getValMap()
        get a reference to the internal value map
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • containsKey

        public boolean containsKey​(java.lang.Object arg0)
        Specified by:
        containsKey in interface java.util.Map<a,​b>
        Parameters:
        arg0 -
        Returns:
        See Also:
        Map.containsKey(java.lang.Object)
      • containsValue

        public boolean containsValue​(java.lang.Object arg0)
        Specified by:
        containsValue in interface java.util.Map<a,​b>
        Parameters:
        arg0 -
        Returns:
        See Also:
        Map.containsValue(java.lang.Object)
      • entrySet

        public java.util.Set<java.util.Map.Entry<a,​b>> entrySet()
        Specified by:
        entrySet in interface java.util.Map<a,​b>
        Returns:
        See Also:
        Map.entrySet()
      • get

        public b get​(java.lang.Object arg0)
        Specified by:
        get in interface java.util.Map<a,​b>
        Parameters:
        arg0 -
        Returns:
        See Also:
        Map.get(java.lang.Object)
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Map<a,​b>
        Returns:
        See Also:
        Map.isEmpty()
      • keySet

        public java.util.Set<a> keySet()
        Specified by:
        keySet in interface java.util.Map<a,​b>
        Returns:
        See Also:
        Map.keySet()
      • putAll

        public void putAll​(java.util.Map<? extends a,​? extends b> arg0)
        Specified by:
        putAll in interface java.util.Map<a,​b>
        Parameters:
        arg0 -
        See Also:
        Map.putAll(java.util.Map)
      • size

        public int size()
        Specified by:
        size in interface java.util.Map<a,​b>
        Returns:
        See Also:
        Map.size()
      • values

        public java.util.Collection<b> values()
        Specified by:
        values in interface java.util.Map<a,​b>
        Returns:
        See Also:
        Map.values()
      • setUnique

        public void setUnique​(boolean b)
        TODO Please insert comment!
        Parameters:
        b -