Class MultiMap<K,​V>


  • public class MultiMap<K,​V>
    extends java.lang.Object
    A map that maps keys to sets of values. Does NOT allow null keys/values.
    • Constructor Summary

      Constructors 
      Constructor Description
      MultiMap()
      Creates an empty MultiMap.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsKey​(K key)
      Returns true if this map contains a mapping for the specified key.
      boolean containsPair​(K key, V value)
      Returns true if this map maps the specified key to the specified value.
      void put​(K key, V value)
      Associates the specified value with the specified key in this multi-map.
      void remove​(java.lang.Object key)
      Removes all the mappings for this key from this map if it is present.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MultiMap

        public MultiMap()
        Creates an empty MultiMap.
    • Method Detail

      • containsKey

        public boolean containsKey​(K key)
        Returns true if this map contains a mapping for the specified key.
      • containsPair

        public boolean containsPair​(K key,
                                    V value)
        Returns true if this map maps the specified key to the specified value.
      • put

        public void put​(K key,
                        V value)
        Associates the specified value with the specified key in this multi-map. Unlike normal Map, if the map previously contained a mapping for this key, the new value is appended to the list of the values mapped from this key.
      • remove

        public void remove​(java.lang.Object key)
        Removes all the mappings for this key from this map if it is present.