接口 MultiValueMap<K,V>

类型参数:
K - the key type
V - the value element type
所有超级接口:
Map<K,List<V>>
所有已知实现类:
LinkedMultiValueMap, MappingMultiValueMap, MultiValueMapAdapter, UnmodifiableMultiValueMap

public interface MultiValueMap<K,V> extends Map<K,List<V>>
Extension of the Map interface that stores multiple values.
从以下版本开始:
2.1.7 2020-01-27 13:06
作者:
Arjen Poutsma, Harry Yang
  • 字段详细资料

    • defaultMappingFunction

      static final Function defaultMappingFunction
    • smartListMappingFunction

      static final Function smartListMappingFunction
    • EMPTY

      static final MultiValueMap EMPTY
  • 方法详细资料

    • getFirst

      @Nullable V getFirst(K key)
      Return the first value for the given key.
      参数:
      key - the key
      返回:
      the first value for the specified key, or null if none
    • add

      void add(K key, @Nullable V value)
      Add the given single value to the current list of values for the given key.
      参数:
      key - the key
      value - the value to be added
    • add

      default void add(Map.Entry<K,V> pair)
    • addAll

      default void addAll(K key, @Nullable V[] values)
      Add all the values of the given list to the current list of values for the given key.
      参数:
      key - they key
      values - the values to be added
      从以下版本开始:
      4.0
    • addAll

      default void addAll(K key, @Nullable Collection<? extends V> values)
      Add all the values of the given list to the current list of values for the given key.
      参数:
      key - they key
      values - the values to be added
      从以下版本开始:
      4.0
    • addAll

      default void addAll(K key, @Nullable Enumeration<? extends V> values)
      Add all the values of the given enumeration to the current enumeration of values for the given key.
      参数:
      key - they key
      values - the values to be added
      从以下版本开始:
      4.0
    • addAll

      default void addAll(@Nullable Map<K,List<V>> values)
      Add all the values of the given MultiValueMap to the current values.
      参数:
      values - the values to be added
    • addAll

      default void addAll(Map.Entry<K,? extends Collection<V>> pair)
      Add all the values of the given MultiValueMap to the current values.
      参数:
      pair - Entry
      从以下版本开始:
      4.0
    • addIfAbsent

      default void addIfAbsent(K key, @Nullable V value)
      Add the given value, only when the map does not contain the given key.
      参数:
      key - the key
      value - the value to be added
    • set

      void set(K key, @Nullable V value)
      Set the given single value under the given key.
      参数:
      key - the key
      value - the value to set
    • setAll

      default void setAll(@Nullable Map<K,V> values)
      Set the given values under.
      参数:
      values - the values.
    • toSingleValueMap

      default Map<K,V> toSingleValueMap()
      Return a Map with the first values contained in this MultiValueMap.
      返回:
      a single value representation of this map
    • toArrayMap

      default Map<K,V[]> toArrayMap(IntFunction<V[]> function)
      从以下版本开始:
      3.0
    • copyToArrayMap

      default void copyToArrayMap(Map<K,V[]> newMap, IntFunction<V[]> mappingFunction)
      从以下版本开始:
      3.0
    • asReadOnly

      default MultiValueMap<K,V> asReadOnly()
      Apply a read-only MultiValueMap wrapper around this MultiValueMap, if necessary.
      返回:
      a read-only variant of the MultiValueMap, or the original map as-is
      从以下版本开始:
      4.0
    • asWritable

      default MultiValueMap<K,V> asWritable()
      Remove any read-only wrapper that may have been previously applied around this map via asReadOnly().
      返回:
      a writable variant of the MultiValueMap, or the original headers as-is
      从以下版本开始:
      4.0
    • empty

      static <K, V> MultiValueMap<K,V> empty()
    • forAdaption

      static <K, V> MultiValueMapAdapter<K,V> forAdaption(Map<K,List<V>> targetMap)
      Adapt a Map<K, List<V>> to an MultiValueMap<K, V>.
      参数:
      targetMap - the original map
      返回:
      the adapted multi-value map (wrapping the original map)
      从以下版本开始:
      4.0
    • forAdaption

      static <K, V> MappingMultiValueMap<K,V> forAdaption(Function<K,List<V>> mappingFunction)
      Adapt a HashMap<K, List<V>> to an MultiValueMap<K, V> with a list value mapping function.
      类型参数:
      K - key
      V - value type
      返回:
      MappingMultiValueMap
    • forSmartListAdaption

      static <K, V> MappingMultiValueMap<K,V> forSmartListAdaption(Map<K,List<V>> targetMap)
      Adapt a HashMap<K, List<V>> to an MultiValueMap<K, V> with a smart list value mapping function.
      类型参数:
      K - key
      V - value type
      返回:
      MappingMultiValueMap
    • forSmartListAdaption

      static <K, V> MappingMultiValueMap<K,V> forSmartListAdaption()
      Adapt a HashMap<K, List<V>> to an MultiValueMap<K, V> with a smart list value mapping function.
      类型参数:
      K - key
      V - value type
      返回:
      MappingMultiValueMap
    • forAdaption

      static <K, V> MappingMultiValueMap<K,V> forAdaption(Map<K,List<V>> targetMap, Function<K,List<V>> mappingFunction)
      Adapt a Map<K, List<V>> to an MultiValueMap<K, V>.
      参数:
      targetMap - the original map
      mappingFunction - list mapping function
      返回:
      the adapted multi-value map (wrapping the original map)
      从以下版本开始:
      4.0
    • copyOf

      static <K, V> LinkedMultiValueMap<K,V> copyOf(Map<K,List<V>> targetMap)
      Adapt a Map<K, List<V>> to an MultiValueMap<K, V>.
      参数:
      targetMap - the original map
      返回:
      the adapted multi-value map (wrapping the original map)
      从以下版本开始:
      4.0
    • forLinkedHashMap

      static <K, V> LinkedMultiValueMap<K,V> forLinkedHashMap()
      Adapt a LinkedHashMap<K, List<V>> to an MultiValueMap<K, V>.
      从以下版本开始:
      4.0
    • forLinkedHashMap

      static <K, V> LinkedMultiValueMap<K,V> forLinkedHashMap(int expectedSize)
      Adapt a LinkedHashMap<K, List<V>> to an MultiValueMap<K, V>.
      参数:
      expectedSize - the expected number of elements (with a corresponding capacity to be derived so that no resize/rehash operations are needed)
      从以下版本开始:
      4.0