Class MapOfSets<K,​V>

  • All Implemented Interfaces:
    MultiMap<K,​V>

    public class MapOfSets<K,​V>
    extends Object
    implements MultiMap<K,​V>
    • Constructor Detail

      • MapOfSets

        public MapOfSets​(Map<K,​Set<V>> multiMap)
      • MapOfSets

        public MapOfSets​(Map<K,​Set<V>> multiMap,
                         Class<? extends Set> setClass)
    • Method Detail

      • put

        public boolean put​(K key,
                           V value)
        Description copied from interface: MultiMap
        Add a value to the specified key.
        Specified by:
        put in interface MultiMap<K,​V>
        Parameters:
        key - the key to add a value to
        value - the value to add
        Returns:
        true if the operation was successful, otherwise false
      • put

        public void put​(K key,
                        Collection<V> value)
        Description copied from interface: MultiMap
        Add a collection of values to the specified key.
        Specified by:
        put in interface MultiMap<K,​V>
        Parameters:
        key - the key to add the values to
        value - the values to add
      • get

        public Collection<V> get​(K key)
        Description copied from interface: MultiMap
        Get all of the values associated with the specified key.
        Specified by:
        get in interface MultiMap<K,​V>
        Parameters:
        key - the key to lookup
        Returns:
        a collection containing all of the values
      • keySet

        public Set<K> keySet()
        Description copied from interface: MultiMap
        Get the Set containing all keys in the map.
        Specified by:
        keySet in interface MultiMap<K,​V>
        Returns:
        the set of keys
      • clear

        public void clear()
        Description copied from interface: MultiMap
        Clear the map of all entries.
        Specified by:
        clear in interface MultiMap<K,​V>
      • getWrappedMap

        public Map<K,​Set<V>> getWrappedMap()