Top Description Fields Constructors Methods
org.springframework.util

public Class LinkedMultiValueMap<K, V>

extends MultiValueMapAdapter<K, V>
implements Serializable, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, java.io.Serializable
Type Parameters
<K>
the key type
<V>
the value element type
Imports
java.io.Serializable, java.util.ArrayList, .LinkedHashMap, .List, .Map

Simple implementation of MultiValueMap that wraps a LinkedHashMap, storing multiple values in an ArrayList.

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.

Authors
Arjen Poutsma, Juergen Hoeller
Since
3.0

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public
LinkedMultiValueMap()

Create a new LinkedMultiValueMap that wraps a LinkedHashMap.

public
LinkedMultiValueMap(int
the expected number of elements (with a corresponding capacity to be derived so that no resize/rehash operations are needed)
expectedSize
)

Create a new LinkedMultiValueMap that wraps a LinkedHashMap with an initial capacity that can accommodate the specified number of elements without any immediate resize/rehash operations to be expected.

public
LinkedMultiValueMap(Map<K, List<V>>
the Map whose mappings are to be placed in this Map
otherMap
)

Copy constructor: Create a new LinkedMultiValueMap with the same mappings as the specified Map.

Method Summary

Modifier and TypeMethod and Description
public LinkedMultiValueMap<K, V>

Returns:

a shallow copy of this Map, reusing this Map's value-holding List entries (even if some entries are shared or unmodifiable) along the lines of standard Map.put semantics
clone
()

Overrides java.lang.Object.clone.

Create a regular copy of this Map.

public LinkedMultiValueMap<K, V>

Returns:

a copy of this Map, including a copy of each value-holding List entry (consistently using an independent modifiable ArrayList for each entry) along the lines of MultiValueMap.addAll semantics
deepCopy
()

Create a deep copy of this Map.

Inherited from org.springframework.util.MultiValueMapAdapter:
addaddAlladdAllclearcontainsKeycontainsValueentrySetequalsforEachgetgetFirsthashCodeisEmptykeySetputputAllputIfAbsentremovesetsetAllsizetoSingleValueMaptoStringvalues

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

LinkedMultiValueMapback to summary
public LinkedMultiValueMap()

Create a new LinkedMultiValueMap that wraps a LinkedHashMap.

LinkedMultiValueMapback to summary
public LinkedMultiValueMap(int expectedSize)

Create a new LinkedMultiValueMap that wraps a LinkedHashMap with an initial capacity that can accommodate the specified number of elements without any immediate resize/rehash operations to be expected.

Parameters
expectedSize:int

the expected number of elements (with a corresponding capacity to be derived so that no resize/rehash operations are needed)

See Also
CollectionUtils#newLinkedHashMap(int)
LinkedMultiValueMapback to summary
public LinkedMultiValueMap(Map<K, List<V>> otherMap)

Copy constructor: Create a new LinkedMultiValueMap with the same mappings as the specified Map. Note that this will be a shallow copy; its value-holding List entries will get reused and therefore cannot get modified independently.

Parameters
otherMap:Map<K, List<V>>

the Map whose mappings are to be placed in this Map

See Also
clone(), deepCopy()

Method Detail

cloneback to summary
public LinkedMultiValueMap<K, V> clone()

Overrides java.lang.Object.clone.

Create a regular copy of this Map.

Returns:LinkedMultiValueMap<K, V>

a shallow copy of this Map, reusing this Map's value-holding List entries (even if some entries are shared or unmodifiable) along the lines of standard Map.put semantics

Annotations
@Override
Since
4.2
See Also
put(Object, List), putAll(Map), LinkedMultiValueMap#LinkedMultiValueMap(Map), deepCopy()
deepCopyback to summary
public LinkedMultiValueMap<K, V> deepCopy()

Create a deep copy of this Map.

Returns:LinkedMultiValueMap<K, V>

a copy of this Map, including a copy of each value-holding List entry (consistently using an independent modifiable ArrayList for each entry) along the lines of MultiValueMap.addAll semantics

Since
4.2
See Also
addAll(MultiValueMap), clone()