Interface MultiValueMap<K,V>

Type Parameters:
K - the key type
V - the value element type
All Superinterfaces:
Map<K,List<V>>
All Known Implementing Classes:
HttpHeaders, LinkedMultiValueMap, MultiValueMapAdapter, StompHeaders, WebSocketHttpHeaders

public interface MultiValueMap<K,V> extends Map<K,List<V>>
Extension of the Map interface that stores multiple values.
Since:
3.0
Author:
Arjen Poutsma
  • Method Details

    • getFirst

      @Nullable V getFirst(K key)
      Return the first value for the given key.
      Parameters:
      key - the key
      Returns:
      the first value for the specified key, or null if none
    • add

      void add(K key, @Nullable V value)
      Add the given single value to the current list of values for the given key.
      Parameters:
      key - the key
      value - the value to be added
    • addAll

      void addAll(K key, List<? extends V> values)
      Add all the values of the given list to the current list of values for the given key.
      Parameters:
      key - they key
      values - the values to be added
      Since:
      5.0
    • addAll

      void addAll(MultiValueMap<K,V> values)
      Add all the values of the given MultiValueMap to the current values.
      Parameters:
      values - the values to be added
      Since:
      5.0
    • addIfAbsent

      default void addIfAbsent(K key, @Nullable V value)
      Add the given value, only when the map does not contain the given key.
      Parameters:
      key - the key
      value - the value to be added
      Since:
      5.2
    • set

      void set(K key, @Nullable V value)
      Set the given single value under the given key.
      Parameters:
      key - the key
      value - the value to set
    • setAll

      void setAll(Map<K,V> values)
      Set the given values under.
      Parameters:
      values - the values.
    • toSingleValueMap

      Map<K,V> toSingleValueMap()
      Return a Map with the first values contained in this MultiValueMap.
      Returns:
      a single value representation of this map