Package org.aoju.bus.core.map
Class MapWrapper<K,V>
java.lang.Object
org.aoju.bus.core.map.MapWrapper<K,V>
- Type Parameters:
K- 键类型V- 值类型
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Map.Entry<K,,V>> Map<K,,V> XWrapper<Map<K,V>>
- Direct Known Subclasses:
AbstractCollValueMap,DuplexingMap,TolerantMap,TransitionMap
public class MapWrapper<K,V>
extends Object
implements Map<K,V>, Iterable<Map.Entry<K,V>>, XWrapper<Map<K,V>>, Serializable, Cloneable
Map包装类,通过包装一个已有Map实现特定功能 例如自定义Key的规则或Value规则
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int默认初始大小protected static final float默认增长因子 -
Constructor Summary
ConstructorsConstructorDescriptionMapWrapper(Supplier<Map<K, V>> mapFactory) 构造 通过传入一个Map从而确定Map的类型,子类需创建一个空的Map,而非传入一个已有Map,否则值可能会被修改MapWrapper(Map<K, V> raw) 构造 -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()MapWrapper<K, V> clone()computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanvoidforEach(BiConsumer<? super K, ? super V> action) getOrDefault(Object key, V defaultValue) getRaw()获取原始的MapinthashCode()booleanisEmpty()iterator()keySet()voidputIfAbsent(K key, V value) booleanbooleanvoidreplaceAll(BiFunction<? super K, ? super V, ? extends V> function) intsize()toString()values()Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
DEFAULT_LOAD_FACTOR
protected static final float DEFAULT_LOAD_FACTOR默认增长因子- See Also:
-
DEFAULT_INITIAL_CAPACITY
protected static final int DEFAULT_INITIAL_CAPACITY默认初始大小- See Also:
-
-
Constructor Details
-
MapWrapper
-
MapWrapper
-
-
Method Details
-
getRaw
-
size
-
isEmpty
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
get
-
put
-
remove
-
putAll
-
clear
-
values
-
keySet
-
entrySet
-
iterator
-
equals
-
hashCode
-
toString
-
forEach
-
replaceAll
- Specified by:
replaceAllin interfaceMap<K,V>
-
putIfAbsent
-
remove
-
replace
-
replace
-
computeIfAbsent
-
getOrDefault
-
computeIfPresent
- Specified by:
computeIfPresentin interfaceMap<K,V>
-
compute
-
merge
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-