类 DefaultMultiValueMap<K,V>

java.lang.Object
cn.taketoday.util.DefaultMultiValueMap<K,V>
类型参数:
K - the key type
V - the value element type
所有已实现的接口:
ArraySizeTrimmer, MultiValueMap<K,V>, Serializable, Cloneable, Map<K,List<V>>
直接已知子类:
LinkedMultiValueMap

public class DefaultMultiValueMap<K,V> extends Object implements MultiValueMap<K,V>, Serializable, Cloneable, ArraySizeTrimmer
Simple implementation of MultiValueMap that wraps a Map, storing multiple values in a List. Can Specify a mappingFunction to determine which List you use , default is 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.

从以下版本开始:
2.1.7
作者:
Arjen Poutsma, Juergen Hoeller, TODAY
2020-01-27 13:15
另请参阅:
  • 字段详细资料

    • serialVersionUID

      private static final long serialVersionUID
      另请参阅:
    • map

      protected final Map<K,List<V>> map
    • mappingFunction

      protected final transient Function<K,List<V>> mappingFunction
  • 构造器详细资料

    • DefaultMultiValueMap

      public DefaultMultiValueMap()
    • DefaultMultiValueMap

      public DefaultMultiValueMap(Function<K,List<V>> mappingFunction)
    • DefaultMultiValueMap

      public DefaultMultiValueMap(int initialCapacity)
    • DefaultMultiValueMap

      public DefaultMultiValueMap(int initialCapacity, float loadFactor)
    • DefaultMultiValueMap

      public DefaultMultiValueMap(int initialCapacity, float loadFactor, Function<K,List<V>> mappingFunction)
    • DefaultMultiValueMap

      public DefaultMultiValueMap(Map<K,List<V>> map)
      adaptation
    • DefaultMultiValueMap

      public DefaultMultiValueMap(Map<K,List<V>> map, Function<K,List<V>> mappingFunction)
    • DefaultMultiValueMap

      public DefaultMultiValueMap(Map<K,List<V>> map, Function<K,List<V>> mappingFunction, boolean copy)
  • 方法详细资料

    • getFirst

      public V getFirst(K key)
      从接口复制的说明: MultiValueMap
      Return the first value for the given key.
      指定者:
      getFirst 在接口中 MultiValueMap<K,V>
      参数:
      key - the key
      返回:
      the first value for the specified key, or null if none
    • add

      public void add(K key, @Nullable V value)
      从接口复制的说明: MultiValueMap
      Add the given single value to the current list of values for the given key.
      指定者:
      add 在接口中 MultiValueMap<K,V>
      参数:
      key - the key
      value - the value to be added
    • addAll

      public void addAll(K key, @Nullable Collection<? extends V> values)
      从接口复制的说明: MultiValueMap
      Add all the values of the given list to the current list of values for the given key.
      指定者:
      addAll 在接口中 MultiValueMap<K,V>
      参数:
      key - they key
      values - the values to be added
    • addAll

      public void addAll(K key, @Nullable Enumeration<? extends V> values)
      从接口复制的说明: MultiValueMap
      Add all the values of the given enumeration to the current enumeration of values for the given key.
      指定者:
      addAll 在接口中 MultiValueMap<K,V>
      参数:
      key - they key
      values - the values to be added
      从以下版本开始:
      4.0
    • set

      public void set(K key, @Nullable V value)
      从接口复制的说明: MultiValueMap
      Set the given single value under the given key.
      指定者:
      set 在接口中 MultiValueMap<K,V>
      参数:
      key - the key
      value - the value to set
    • trimToSize

      public void trimToSize()
      Trims the capacity of this map internal value ArrayList instance to be the list's current size. An application can use this operation to minimize the storage of an ArrayList instance.
      指定者:
      trimToSize 在接口中 ArraySizeTrimmer
      从以下版本开始:
      4.0
      另请参阅:
    • size

      public int size()
      指定者:
      size 在接口中 Map<K,V>
    • isEmpty

      public boolean isEmpty()
      指定者:
      isEmpty 在接口中 Map<K,V>
    • containsKey

      public boolean containsKey(Object key)
      指定者:
      containsKey 在接口中 Map<K,V>
    • containsValue

      public boolean containsValue(Object value)
      指定者:
      containsValue 在接口中 Map<K,V>
    • get

      @Nullable public List<V> get(Object key)
      指定者:
      get 在接口中 Map<K,V>
    • put

      @Nullable public List<V> put(K key, List<V> value)
      指定者:
      put 在接口中 Map<K,V>
    • remove

      @Nullable public List<V> remove(Object key)
      指定者:
      remove 在接口中 Map<K,V>
    • putAll

      public void putAll(@NonNull Map<? extends K,? extends List<V>> map)
      指定者:
      putAll 在接口中 Map<K,V>
    • clear

      public void clear()
      指定者:
      clear 在接口中 Map<K,V>
    • keySet

      public Set<K> keySet()
      指定者:
      keySet 在接口中 Map<K,V>
    • values

      public Collection<List<V>> values()
      指定者:
      values 在接口中 Map<K,V>
    • entrySet

      public Set<Map.Entry<K,List<V>>> entrySet()
      指定者:
      entrySet 在接口中 Map<K,V>
    • deepCopy

      public DefaultMultiValueMap<K,V> deepCopy()
      Create a deep copy of this Map.
      返回:
      a copy of this Map, including a copy of each value-holding List entry (consistently using an independent modifiable List for each entry) along the lines of MultiValueMap.addAll semantics
      从以下版本开始:
      2.1.7
      另请参阅:
    • clone

      public DefaultMultiValueMap<K,V> clone()
      Create a regular copy of this Map.
      覆盖:
      clone 在类中 Object
      返回:
      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
      从以下版本开始:
      4.0
      另请参阅:
    • cloneMap

      public DefaultMultiValueMap<K,V> cloneMap()
      从以下版本开始:
      4.0
    • equals

      public boolean equals(Object obj)
      指定者:
      equals 在接口中 Map<K,V>
      覆盖:
      equals 在类中 Object
    • hashCode

      public int hashCode()
      指定者:
      hashCode 在接口中 Map<K,V>
      覆盖:
      hashCode 在类中 Object
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object