MultiValueMap<K,V>
, java.io.Serializable
, java.lang.Cloneable
, java.util.Map<K,java.util.List<V>>
public class LinkedMultiValueMap<K,V> extends java.util.LinkedHashMap<K,java.util.List<V>> implements MultiValueMap<K,V>, java.io.Serializable
MultiValueMap
that wraps a LinkedHashMap
,
storing multiple values in a LinkedList
.
This Map implementation is generally not thread-safe. It is primarily designed for data structures exposed from request objects, for use in a single thread only.
Constructor | Description |
---|---|
LinkedMultiValueMap() |
Create a new LinkedMultiValueMap that wraps a
LinkedHashMap . |
LinkedMultiValueMap(int initialCapacity) |
Create a new LinkedMultiValueMap that wraps a
LinkedHashMap
with the given initial capacity. |
LinkedMultiValueMap(java.util.Map<K,java.util.List<V>> otherMap) |
Copy constructor: Create a new LinkedMultiValueMap with the same mappings as
the specified Map.
|
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.
|
LinkedMultiValueMap<K,V> |
clone() |
Create a regular copy of this Map.
|
LinkedMultiValueMap<K,V> |
deepCopy() |
Create a deep copy of this Map.
|
V |
getFirst(K key) |
Return the first value for the given key.
|
void |
put(K key,
V[] values) |
Set the given values under the given key.
|
void |
set(K key,
V value) |
Set the given single value under the given key.
|
void |
setAll(java.util.Map<K,V> values) |
Set the given values under.
|
java.util.Map<K,V> |
toSingleValueMap() |
Returns the first values contained in this
MultiValueMap . |
compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
public LinkedMultiValueMap()
LinkedHashMap
.public LinkedMultiValueMap(int initialCapacity)
LinkedHashMap
with the given initial capacity.initialCapacity
- the initial capacitypublic LinkedMultiValueMap(java.util.Map<K,java.util.List<V>> otherMap)
otherMap
- the Map whose mappings are to be placed in this Mapclone()
,
deepCopy()
public void add(K key, V value)
MultiValueMap
add
in interface MultiValueMap<K,V>
key
- the keyvalue
- the value to be addedpublic V getFirst(K key)
MultiValueMap
getFirst
in interface MultiValueMap<K,V>
key
- the keynull
public void set(K key, V value)
MultiValueMap
set
in interface MultiValueMap<K,V>
key
- the keyvalue
- the value to setpublic void setAll(java.util.Map<K,V> values)
MultiValueMap
setAll
in interface MultiValueMap<K,V>
values
- the valuespublic void put(K key, V[] values)
MultiValueMap
put
in interface MultiValueMap<K,V>
key
- the keyvalues
- the valuespublic java.util.Map<K,V> toSingleValueMap()
MultiValueMap
MultiValueMap
.toSingleValueMap
in interface MultiValueMap<K,V>
public LinkedMultiValueMap<K,V> clone()
clone
in class java.util.HashMap<K,java.util.List<V>>
LinkedMultiValueMap(Map)
,
deepCopy()
public LinkedMultiValueMap<K,V> deepCopy()
clone()
Copyright © 2008–2018 The Aspectran Project. All rights reserved.