Class HashSetMultimap<K,​V>

  • Type Parameters:
    K - the type of keys maintained by this map
    V - the type of mapped values
    All Implemented Interfaces:
    Multimap<K,​V>, SetMultimap<K,​V>

    public class HashSetMultimap<K,​V>
    extends Object
    implements SetMultimap<K,​V>
    Hash table based implementation of the SetMultimap interface.

    This data structure is not thread-safe!

    • Constructor Detail

      • HashSetMultimap

        public HashSetMultimap​(int initialMapCapacity,
                               int initialSetCapacity)
      • HashSetMultimap

        public HashSetMultimap()
    • Method Detail

      • put

        public boolean put​(K key,
                           V value)
        Description copied from interface: Multimap
        Associates the specified value with the specified key in this map.
        Specified by:
        put in interface Multimap<K,​V>
        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
      • remove

        public boolean remove​(K key,
                              V value)
        Description copied from interface: Multimap
        Removes the specified value from the specified key. If no value left, the associated key will be removed from the map.
        Specified by:
        remove in interface Multimap<K,​V>
        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
      • get

        public Set<V> get​(Object key)
        Description copied from interface: Multimap
        Returns the values that are associated to the specified key. Returns a empty Collection if currently no values are assosicated to the key.
        Specified by:
        get in interface Multimap<K,​V>
        Specified by:
        get in interface SetMultimap<K,​V>
        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.
      • keySet

        public Set<K> keySet()
        Description copied from interface: Multimap
        Returns a Set with all the keys contained in this map.
        Specified by:
        keySet in interface Multimap<K,​V>
        Returns:
        Set with all the keys contained in this map