Package org.springframework.util
Interface MultiValueMap<K,V>
- Type Parameters:
K
- the key typeV
- the value element type
- All Known Implementing Classes:
HttpHeaders
,LinkedMultiValueMap
,StompHeaders
,WebSocketHttpHeaders
public interface MultiValueMap<K,V> extends Map<K,List<V>>
Extension of theMap
interface that stores multiple values.- Since:
- 3.0
- Author:
- Arjen Poutsma
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(K key, V value)
Add the given single value to the current list of values for the given key.V
getFirst(K key)
Return the first value for the given key.void
set(K key, V value)
Set the given single value under the given key.void
setAll(Map<K,V> values)
Set the given values under.Map<K,V>
toSingleValueMap()
Return aMap
with the first values contained in thisMultiValueMap
.Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
Method Detail
getFirst
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, V value)
Add the given single value to the current list of values for the given key.- Parameters:
key
- the keyvalue
- the value to be added
set
void set(K key, V value)
Set the given single value under the given key.- Parameters:
key
- the keyvalue
- the value to set
toSingleValueMap
Map<K,V> toSingleValueMap()
Return aMap
with the first values contained in thisMultiValueMap
.- Returns:
- a single value representation of this map