Package org.aoju.bus.core.map
Class AbstractCollValueMap<K,V,C extends Collection<V>>
java.lang.Object
org.aoju.bus.core.map.MapWrapper<K,C>
org.aoju.bus.core.map.AbstractCollValueMap<K,V,C>
- Type Parameters:
K- 键类型V- 值类型C- 集合类型
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Map.Entry<K,,C>> Map<K,C>
- Direct Known Subclasses:
CollectionValueMap,ListValueMap,SetValueMap
值作为集合的Map实现,通过调用putValue可以在相同key时加入多个值,多个值用集合表示
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int默认集合初始大小Fields inherited from class org.aoju.bus.core.map.MapWrapper
DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR -
Constructor Summary
ConstructorsConstructorDescription构造AbstractCollValueMap(float loadFactor, Map<? extends K, C> m) 构造AbstractCollValueMap(int initialCapacity) 构造AbstractCollValueMap(int initialCapacity, float loadFactor) 构造AbstractCollValueMap(Map<? extends K, C> m) 构造 -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract C创建集合 此方法用于创建在putValue后追加值所在的集合,子类实现此方法创建不同类型的集合获取值voidputAllValues(Map<? extends K, ? extends Collection<V>> m) 放入所有valuevoid放入Value 如果键对应值列表有值,加入,否则创建一个新列表后加入Methods inherited from class org.aoju.bus.core.map.MapWrapper
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, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
DEFAULT_COLLECTION_INITIAL_CAPACITY
protected static final int DEFAULT_COLLECTION_INITIAL_CAPACITY默认集合初始大小- See Also:
-
-
Constructor Details
-
AbstractCollValueMap
public AbstractCollValueMap()构造 -
AbstractCollValueMap
public AbstractCollValueMap(int initialCapacity) 构造- Parameters:
initialCapacity- 初始大小
-
AbstractCollValueMap
构造- Parameters:
m- Map
-
AbstractCollValueMap
构造- Parameters:
loadFactor- 加载因子m- Map
-
AbstractCollValueMap
public AbstractCollValueMap(int initialCapacity, float loadFactor) 构造- Parameters:
initialCapacity- 初始大小loadFactor- 加载因子
-
-
Method Details
-
putAllValues
放入所有value- Parameters:
m- valueMap
-
putValue
放入Value 如果键对应值列表有值,加入,否则创建一个新列表后加入- Parameters:
key- 键value- 值
-
get
获取值- Parameters:
key- 键index- 第几个值的索引,越界返回null- Returns:
- 值或null
-
createCollection
创建集合 此方法用于创建在putValue后追加值所在的集合,子类实现此方法创建不同类型的集合- Returns:
Collection
-