K
- 键类型V
- 值类型public class CollectionValueMap<K,V> extends AbsCollValueMap<K,V>
MultiValueMap
的通用实现,可视为值为Collection
集合的Map
集合。
构建时指定一个工厂方法用于生成原始的Map
集合,然后再指定一个工厂方法用于生成自定义类型的值集合。
当调用MultiValueMap
中格式为“putXXX”的方法时,将会为key创建值集合,并将key相同的值追加到集合中
DEFAULT_COLLECTION_INITIAL_CAPACITY
DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR
Constructor and Description |
---|
CollectionValueMap()
|
CollectionValueMap(Map<K,Collection<V>> map)
创建一个多值映射集合,默认基于指定Map与指定List类型实现
|
CollectionValueMap(SerSupplier<Collection<V>> collFactory)
创建一个多值映射集合,默认基于
HashMap 与collFactory 生成的集合实现 |
CollectionValueMap(Supplier<Map<K,Collection<V>>> mapFactory,
SerSupplier<Collection<V>> collFactory)
创建一个多值映射集合,基于
mapFactory 与collFactory 实现 |
Modifier and Type | Method and Description |
---|---|
protected Collection<V> |
createCollection()
创建集合
此方法用于创建在putValue后追加值所在的集合,子类实现此方法创建不同类型的集合 |
filterAllValues, putAllValues, putValue, removeAllValues, removeValue, replaceAllValues
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, getRaw, hashCode, isEmpty, iterator, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, toString, values
finalize, getClass, notify, notifyAll, wait, wait, wait
allForEach, allValues, filterAllValues, getValue, getValues, put, putAll, putAllValues, putValues, removeValues, replaceAllValues, size
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
forEach, spliterator
public CollectionValueMap(Supplier<Map<K,Collection<V>>> mapFactory, SerSupplier<Collection<V>> collFactory)
mapFactory
与collFactory
实现mapFactory
- 生成集合的工厂方法collFactory
- 生成值集合的工厂方法public CollectionValueMap(SerSupplier<Collection<V>> collFactory)
HashMap
与collFactory
生成的集合实现collFactory
- 生成值集合的工厂方法public CollectionValueMap()
public CollectionValueMap(Map<K,Collection<V>> map)
map
- 提供数据的原始集合protected Collection<V> createCollection()
AbsCollValueMap
createCollection
in class AbsCollValueMap<K,V>
Collection
Copyright © 2025. All rights reserved.