K
- the key typeV
- the value element typepublic class MultiValueMapAdapter<K,V> extends Object implements MultiValueMap<K,V>, Serializable
Map
to the MultiValueMap
contract.CollectionUtils.toMultiValueMap(java.util.Map<K, java.util.List<V>>)
,
LinkedMultiValueMap
,
Serialized FormConstructor and Description |
---|
MultiValueMapAdapter(Map<K,List<V>> targetMap)
Wrap the given target
Map as a MultiValueMap adapter. |
Modifier and Type | Method and Description |
---|---|
void |
add(K key,
V value)
Add the given single value to the current list of values for the given key.
|
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.
|
void |
addAll(MultiValueMap<K,V> values)
Add all the values of the given
MultiValueMap to the current values. |
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,List<V>>> |
entrySet() |
boolean |
equals(Object other) |
List<V> |
get(Object key) |
V |
getFirst(K key)
Return the first value for the given key.
|
int |
hashCode() |
boolean |
isEmpty() |
Set<K> |
keySet() |
List<V> |
put(K key,
List<V> value) |
void |
putAll(Map<? extends K,? extends List<V>> map) |
List<V> |
remove(Object 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.
|
int |
size() |
Map<K,V> |
toSingleValueMap()
Return a
Map with the first values contained in this MultiValueMap . |
String |
toString() |
Collection<List<V>> |
values() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addIfAbsent
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
@Nullable public V getFirst(K key)
MultiValueMap
getFirst
in interface MultiValueMap<K,V>
key
- the keynull
if nonepublic void add(K key, @Nullable V value)
MultiValueMap
add
in interface MultiValueMap<K,V>
key
- the keyvalue
- the value to be addedpublic void addAll(K key, List<? extends V> values)
MultiValueMap
addAll
in interface MultiValueMap<K,V>
key
- they keyvalues
- the values to be addedpublic void addAll(MultiValueMap<K,V> values)
MultiValueMap
MultiValueMap
to the current values.addAll
in interface MultiValueMap<K,V>
values
- the values to be addedpublic void set(K key, @Nullable V value)
MultiValueMap
set
in interface MultiValueMap<K,V>
key
- the keyvalue
- the value to setpublic void setAll(Map<K,V> values)
MultiValueMap
setAll
in interface MultiValueMap<K,V>
values
- the values.public Map<K,V> toSingleValueMap()
MultiValueMap
Map
with the first values contained in this MultiValueMap
.toSingleValueMap
in interface MultiValueMap<K,V>
public boolean containsKey(Object key)
containsKey
in interface Map<K,List<V>>
public boolean containsValue(Object value)
containsValue
in interface Map<K,List<V>>
public int hashCode()