Class AbstractListValuedMap<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:
    ListValuedMap<K,​V>, MultiValuedMap<K,​V>
    Direct Known Subclasses:

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

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

    • Method Detail

      • get

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

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

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

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