Class AbstractSetValuedMap<K,​V>

  • Type Parameters:
    K - the type of the keys in this map
    V - the type of the values in this map
    All Implemented Interfaces:
    MultiValuedMap<K,​V>, SetValuedMap<K,​V>
    Direct Known Subclasses:

    public abstract class AbstractSetValuedMap<K,​V>
    extends AbstractMultiValuedMap<K,​V>
    implements SetValuedMap<K,​V>
    Abstract implementation of the SetValuedMap interface to simplify the creation of subclass implementations.

    Subclasses specify a Map implementation to use as the internal storage and the Set implementation to use as values.

    • Method Detail

      • get

        public java.util.Set<V> get​(K key)
        Gets the set of values associated with the specified key. This would return an empty set in case the mapping is not present
        Specified by:
        get in interface MultiValuedMap<K,​V>
        Specified by:
        get in interface SetValuedMap<K,​V>
        get in class AbstractMultiValuedMap<K,​V>
        key - the key to retrieve
        the Set of values, will return an empty Set for no mapping
      • remove

        public java.util.Set<V> remove​(java.lang.Object key)
        Removes all values associated with the specified key.

        A subsequent get(Object) would return an empty set.

        Specified by:
        remove in interface MultiValuedMap<K,​V>
        Specified by:
        remove in interface SetValuedMap<K,​V>
        remove in class AbstractMultiValuedMap<K,​V>
        key - the key to remove values from
        the Set of values removed, will return an empty, unmodifiable set for no mapping found.