Interface MultiMap<K,​V>

  • Type Parameters:
    K - the type of key
    V - the type of value
    All Known Implementing Classes:
    MapOfSets

    public interface MultiMap<K,​V>
    Map-like data structure where keys may correspond to multiple values.
    • Method Detail

      • put

        boolean put​(K key,
                    V value)
        Add a value to the specified key.
        Parameters:
        key - the key to add a value to
        value - the value to add
        Returns:
        true if the operation was successful, otherwise false
      • put

        void put​(K key,
                 Collection<V> values)
        Add a collection of values to the specified key.
        Parameters:
        key - the key to add the values to
        values - the values to add
      • get

        Collection<V> get​(K key)
        Get all of the values associated with the specified key.
        Parameters:
        key - the key to lookup
        Returns:
        a collection containing all of the values
      • keySet

        Set<K> keySet()
        Get the Set containing all keys in the map.
        Returns:
        the set of keys
      • clear

        void clear()
        Clear the map of all entries.
      • putAll

        default void putAll​(MultiMap<K,​V> map)
        Add all of the contents of another MultiMap to this instance.
        Parameters:
        map - the map containing the entries to add to this map instance