Package org.springframework.util
Class MultiValueMapAdapter<K,V>
java.lang.Object
org.springframework.util.MultiValueMapAdapter<K,V>
- Type Parameters:
K
- the key typeV
- the value element type
- All Implemented Interfaces:
Serializable
,Map<K,
,List<V>> MultiValueMap<K,
V>
- Direct Known Subclasses:
LinkedMultiValueMap
Adapts a given
Map
to the MultiValueMap
contract.- Since:
- 5.3
- Author:
- Arjen Poutsma, Juergen Hoeller
- See Also:
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionMultiValueMapAdapter
(Map<K, List<V>> targetMap) Wrap the given targetMap
as aMultiValueMap
adapter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the given single value to the current list of values for the given key.void
Add all the values of the given list to the current list of values for the given key.void
addAll
(MultiValueMap<K, V> values) Add all the values of the givenMultiValueMap
to the current values.void
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
void
forEach
(BiConsumer<? super K, ? super List<V>> action) Return the first value for the given key.int
hashCode()
boolean
isEmpty()
keySet()
void
putIfAbsent
(K key, List<V> value) void
Set the given single value under the given key.void
Set the given values under.int
size()
Return aMap
with the first values contained in thisMultiValueMap
.toString()
Collection<List<V>>
values()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, getOrDefault, merge, remove, replace, replace, replaceAll
Methods inherited from interface org.springframework.util.MultiValueMap
addIfAbsent
-
Constructor Details
-
MultiValueMapAdapter
Wrap the given targetMap
as aMultiValueMap
adapter.- Parameters:
targetMap
- the plain targetMap
-
-
Method Details
-
getFirst
Description copied from interface:MultiValueMap
Return the first value for the given key.- Specified by:
getFirst
in interfaceMultiValueMap<K,
V> - Parameters:
key
- the key- Returns:
- the first value for the specified key, or
null
if none
-
add
Description copied from interface:MultiValueMap
Add the given single value to the current list of values for the given key.- Specified by:
add
in interfaceMultiValueMap<K,
V> - Parameters:
key
- the keyvalue
- the value to be added
-
addAll
Description copied from interface:MultiValueMap
Add all the values of the given list to the current list of values for the given key.- Specified by:
addAll
in interfaceMultiValueMap<K,
V> - Parameters:
key
- they keyvalues
- the values to be added
-
addAll
Description copied from interface:MultiValueMap
Add all the values of the givenMultiValueMap
to the current values.- Specified by:
addAll
in interfaceMultiValueMap<K,
V> - Parameters:
values
- the values to be added
-
set
Description copied from interface:MultiValueMap
Set the given single value under the given key.- Specified by:
set
in interfaceMultiValueMap<K,
V> - Parameters:
key
- the keyvalue
- the value to set
-
setAll
Description copied from interface:MultiValueMap
Set the given values under.- Specified by:
setAll
in interfaceMultiValueMap<K,
V> - Parameters:
values
- the values.
-
toSingleValueMap
Description copied from interface:MultiValueMap
Return aMap
with the first values contained in thisMultiValueMap
.- Specified by:
toSingleValueMap
in interfaceMultiValueMap<K,
V> - Returns:
- a single value representation of this map
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V>
-
get
-
put
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceMap<K,
V>
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
forEach
-
equals
-
hashCode
public int hashCode() -
toString
-