Class LinkedMultiValueMap<K,​V>

    • Constructor Detail

      • LinkedMultiValueMap

        public LinkedMultiValueMap()
        Create a new LinkedMultiValueMap that wraps a LinkedHashMap.
      • LinkedMultiValueMap

        public LinkedMultiValueMap​(int initialCapacity)
        Create a new LinkedMultiValueMap that wraps a LinkedHashMap with the given initial capacity.
        Parameters:
        initialCapacity - the initial capacity
      • LinkedMultiValueMap

        public LinkedMultiValueMap​(Map<K,​List<V>> otherMap)
        Copy constructor: Create a new LinkedMultiValueMap with the same mappings as the specified Map. Note that this will be a shallow copy; its value-holding List entries will get reused and therefore cannot get modified independently.
        Parameters:
        otherMap - the Map whose mappings are to be placed in this Map
        See Also:
        clone(), deepCopy()
    • Method Detail

      • add

        public void add​(K key,
                        V value)
        Description copied from interface: MultiValueMap
        Add the given single value to the current list of values for the given key.
        Specified by:
        add in interface MultiValueMap<K,​V>
        Parameters:
        key - the key
        value - the value to be added
      • getFirst

        public V getFirst​(K key)
        Description copied from interface: MultiValueMap
        Return the first value for the given key.
        Specified by:
        getFirst in interface MultiValueMap<K,​V>
        Parameters:
        key - the key
        Returns:
        the first value for the specified key, or null
      • set

        public void set​(K key,
                        V value)
        Description copied from interface: MultiValueMap
        Set the given single value under the given key.
        Specified by:
        set in interface MultiValueMap<K,​V>
        Parameters:
        key - the key
        value - the value to set
      • setAll

        public void setAll​(Map<K,​V> values)
        Description copied from interface: MultiValueMap
        Set the given values under.
        Specified by:
        setAll in interface MultiValueMap<K,​V>
        Parameters:
        values - the values.
      • toSingleValueMap

        public Map<K,​V> toSingleValueMap()
        Description copied from interface: MultiValueMap
        Returns the first values contained in this MultiValueMap.
        Specified by:
        toSingleValueMap in interface MultiValueMap<K,​V>
        Returns:
        a single value representation of this map
      • size

        public int size()
        Specified by:
        size in interface Map<K,​V>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface Map<K,​V>
      • containsKey

        public boolean containsKey​(Object key)
        Specified by:
        containsKey in interface Map<K,​V>
      • put

        public List<V> put​(K key,
                           List<V> value)
        Specified by:
        put in interface Map<K,​V>
      • putAll

        public void putAll​(Map<? extends K,​? extends List<V>> map)
        Specified by:
        putAll in interface Map<K,​V>
      • clear

        public void clear()
        Specified by:
        clear in interface Map<K,​V>
      • keySet

        public Set<K> keySet()
        Specified by:
        keySet in interface Map<K,​V>
      • deepCopy

        public LinkedMultiValueMap<K,​V> deepCopy()
        Create a deep copy of this Map.
        Returns:
        a copy of this Map, including a copy of each value-holding List entry
        Since:
        4.2
        See Also:
        clone()