Interface Multimap<K,​V>

  • Type Parameters:
    K - the type of keys maintained by this map
    V - the type of mapped values
    All Known Subinterfaces:
    SetMultimap<K,​V>
    All Known Implementing Classes:
    HashSetMultimap

    public interface Multimap<K,​V>
    A map in which more than one value may be associated with and returned for a given key
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Collection<V> get​(Object key)
      Returns the values that are associated to the specified key.
      Set<K> keySet()
      Returns a Set with all the keys contained in this map.
      boolean put​(K key, V value)
      Associates the specified value with the specified key in this map.
      boolean remove​(K key, V value)
      Removes the specified value from the specified key.
    • Method Detail

      • put

        boolean put​(K key,
                    V value)
        Associates the specified value with the specified key in this map.
        Parameters:
        key - key with which the specified value is to be associated
        value - value to be associated with the specified key
        Returns:
        true if the specified value could be associated with the specified key
        Throws:
        NullPointerException - if key is null
      • remove

        boolean remove​(K key,
                       V value)
        Removes the specified value from the specified key. If no value left, the associated key will be removed from the map.
        Parameters:
        key - key with which the specified value is associated
        value - value expected to be associated with the specified key
        Returns:
        true if the specified value could be removed from the specified key
        Throws:
        NullPointerException - if key is null
      • get

        Collection<V> get​(Object key)
        Returns the values that are associated to the specified key. Returns a empty Collection if currently no values are assosicated to the key.
        Parameters:
        key - the key whose associated values should be returned
        Returns:
        the values that are associated to the specified key. Returns a empty Collection if currently no values are assosicated to the key.
        Throws:
        NullPointerException - if key is null
      • keySet

        Set<K> keySet()
        Returns a Set with all the keys contained in this map.
        Returns:
        Set with all the keys contained in this map