Class LinkedMultivalueMap<K,v>

java.lang.Object
org.springframework.util.MultivalueMapAdapter<K,v>
org.springframework.util.LinkedMultivalueMap<K,v>
Type Parameters:
K - the key type
v - the value element type
All Implemented Interfaces:
Serializable, Cloneable, Map<K,List<v>>, MultivalueMap<K,v>

public class LinkedMultivalueMap<K,v> extends MultivalueMapAdapter<K,v> implements Serializable, Cloneable
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.

Since:
3.0
Author:
Arjen Poutsma, Juergen Hoeller
See Also:
  • Constructor Details

    • LinkedMultivalueMap

      public LinkedMultivalueMap()
      Create a new LinkedMultivalueMap that wraps a LinkedHashMap.
    • LinkedMultivalueMap

      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 - the expected number of elements (with a corresponding capacity to be derived so that no resize/rehash operations are needed)
      See Also:
    • LinkedMultivalueMap

      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 - the Map whose mappings are to be placed in this Map
      See Also:
  • Method Details