Interface MultiMap<K,V>

Type Parameters:
K - the type of keys
V - the type of values
All Known Implementing Classes:
ArraySetMultiMap, HashSetMultiMap

public interface MultiMap<K,V>
A map from non-null keys to sets of non-null values.

Callers must not add null values to the sets returned by this map.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    boolean
     
    get(@Nullable K key)
    Returns the values associated with key, or an empty set if key is null.
    boolean
     
     
    boolean
    put(K key, V val)
     
    boolean
    putAll(K key, Collection<? extends V> vals)
     
    boolean
    remove(K key, V val)
     
    removeAll(K key)
    Returns the set associated with key, or an empty set if key is not a key in this multi-map.
    int
     
     
  • Method Details

    • get

      Set<V> get(@Nullable K key)
      Returns the values associated with key, or an empty set if key is null.

      For a missing non-null key, implementations may create and return a mutable set, or return an empty set without changing the map. A null lookup never creates a mapping.

    • put

      boolean put(K key, V val)
    • remove

      boolean remove(K key, V val)
    • keySet

      Set<K> keySet()
    • containsKey

      boolean containsKey(K key)
    • size

      int size()
    • toString

      String toString()
      Overrides:
      toString in class Object
    • putAll

      boolean putAll(K key, Collection<? extends V> vals)
    • removeAll

      Set<V> removeAll(K key)
      Returns the set associated with key, or an empty set if key is not a key in this multi-map.
    • clear

      void clear()
    • isEmpty

      boolean isEmpty()