K - 键类型V - 值类型public class CollectionValueMap<K,V> extends AbsCollValueMap<K,V>
MultiValueMap的通用实现,可视为值为Collection集合的Map集合。
构建时指定一个工厂方法用于生成原始的Map集合,然后再指定一个工厂方法用于生成自定义类型的值集合。
当调用MultiValueMap中格式为“putXXX”的方法时,将会为key创建值集合,并将key相同的值追加到集合中
DEFAULT_COLLECTION_INITIAL_CAPACITYDEFAULT_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, replaceAllValuesclear, 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, valuesfinalize, getClass, notify, notifyAll, wait, wait, waitallForEach, allValues, filterAllValues, getValue, getValues, put, putAll, putAllValues, putValues, removeValues, replaceAllValues, sizeclear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesforEach, spliteratorpublic 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()
AbsCollValueMapcreateCollection in class AbsCollValueMap<K,V>CollectionCopyright © 2025. All rights reserved.