Top Description Methods
org.springframework.util

public Interface MultiValueMap<K, V>

extends Map<K, List<V>>
Known Direct Implementers
org.springframework.util.MultiValueMapAdapter, org.springframework.util.UnmodifiableMultiValueMap
Type Parameters
<K>
the key type
<V>
the value element type
Imports
java.util.List, .Map, org.springframework.lang.Nullable

Extension of the Map interface that stores multiple values.
Author
Arjen Poutsma
Since
3.0

Method Summary

Modifier and TypeMethod and Description
public void
add(K
the key
key
,
V
the value to be added
value
)

Add the given single value to the current list of values for the given key.

public void
addAll(K
they key
key
,
List<? extends V>
the values to be added
values
)

Add all the values of the given list to the current list of values for the given key.

public void
addAll(MultiValueMap<K, V>
the values to be added
values
)

Add all the values of the given MultiValueMap to the current values.

public default void
addIfAbsent(K
the key
key
,
V
the value to be added
value
)

Add the given value, only when the map does not contain the given key.

public V

Returns:

the first value for the specified key, or null if none
getFirst
(K
the key
key
)

Return the first value for the given key.

public void
set(K
the key
key
,
V
the value to set
value
)

Set the given single value under the given key.

public void
setAll(Map<K, V>
the values.
values
)

Set the given values under.

public Map<K, V>

Returns:

a single value representation of this map
toSingleValueMap
()

Return a Map with the first values contained in this MultiValueMap.

Inherited from java.util.Map:
clearcomputecomputeIfAbsentcomputeIfPresentcontainsKeycontainsValuecopyOfentryentrySetequalsforEachgetgetOrDefaulthashCodeisEmptykeySetmergeofofofofofofofofofofofofEntriesputputAllputIfAbsentremoveremovereplacereplacereplaceAllsizevalues

Method Detail

addback to summary
public void add(K key, V value)

Add the given single value to the current list of values for the given key.

Parameters
key:K

the key

value:V

the value to be added

addAllback to summary
public 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:K

they key

values:List<? extends V>

the values to be added

Since
5.0
addAllback to summary
public void addAll(MultiValueMap<K, V> values)

Add all the values of the given MultiValueMap to the current values.

Parameters
values:MultiValueMap<K, V>

the values to be added

Since
5.0
addIfAbsentback to summary
public default void addIfAbsent(K key, V value)

Add the given value, only when the map does not contain the given key.

Parameters
key:K

the key

value:V

the value to be added

Since
5.2
getFirstback to summary
public V getFirst(K key)

Return the first value for the given key.

Parameters
key:K

the key

Returns:V

the first value for the specified key, or null if none

Annotations
@Nullable
setback to summary
public void set(K key, V value)

Set the given single value under the given key.

Parameters
key:K

the key

value:V

the value to set

setAllback to summary
public void setAll(Map<K, V> values)

Set the given values under.

Parameters
values:Map<K, V>

the values.

toSingleValueMapback to summary
public Map<K, V> toSingleValueMap()

Return a Map with the first values contained in this MultiValueMap.

Returns:Map<K, V>

a single value representation of this map