Class BiMultiMap<K>

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

    public class BiMultiMap<K>
    extends java.util.HashMap<K,​java.lang.Object>
    Extension of HashMap that provides two main features. Firstly it allows reverse lookup for a key given a value, by storing a second HashMap internally which maps values to keys. Secondly, it supports Collection values, in which case, each item in the collection is used as a key in the internal reverse HashMap. It's therefore up to the caller to ensure the overall set of values, and collection values, are unique.

    Used by GeoJsonRenderer to store GeoJsonFeature instances mapped to corresponding Marker, Polyline, and Polygon map objects. We want to look these up in reverse to provide access to GeoJsonFeature instances when map objects are clicked.

    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>
    • Constructor Summary

      Constructors 
      Constructor Description
      BiMultiMap()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      BiMultiMap<K> clone()  
      K getKey​(java.lang.Object value)
      Reverse lookup of key by value.
      java.lang.Object put​(K key, java.lang.Object value)  
      java.lang.Object put​(K key, java.util.Collection values)  
      void putAll​(java.util.Map<? extends K,​?> map)  
      java.lang.Object remove​(java.lang.Object key)  
      • Methods inherited from class java.util.HashMap

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

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        equals, hashCode
    • Constructor Detail

      • BiMultiMap

        public BiMultiMap()
    • Method Detail

      • putAll

        public void putAll​(java.util.Map<? extends K,​?> map)
        Specified by:
        putAll in interface java.util.Map<K,​java.lang.Object>
        Overrides:
        putAll in class java.util.HashMap<K,​java.lang.Object>
      • put

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

        public java.lang.Object put​(K key,
                                    java.util.Collection values)
      • remove

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

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

        @NonNull
        public BiMultiMap<K> clone()
        Overrides:
        clone in class java.util.HashMap<K,​java.lang.Object>
      • getKey

        public K getKey​(java.lang.Object value)
        Reverse lookup of key by value.
        Parameters:
        value - Value to lookup
        Returns:
        Key for the given value