K
- 键类型V
- 值类型public abstract class TransMap<K,V> extends MapWrapper<K,V>
DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR
Constructor and Description |
---|
TransMap(Map<K,V> emptyMap)
构造
通过传入一个Map从而确定Map的类型,子类需创建一个空的Map,而非传入一个已有Map,否则值可能会被修改 |
TransMap(Supplier<Map<K,V>> mapFactory)
构造
通过传入一个Map从而确定Map的类型,子类需创建一个空的Map,而非传入一个已有Map,否则值可能会被修改 |
Modifier and Type | Method and Description |
---|---|
V |
compute(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction) |
V |
computeIfAbsent(K key,
Function<? super K,? extends V> mappingFunction) |
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction) |
boolean |
containsKey(Object key) |
protected abstract K |
customKey(Object key)
自定义键
|
protected abstract V |
customValue(Object value)
自定义值
|
V |
get(Object key) |
V |
getOrDefault(Object key,
V defaultValue) |
V |
merge(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction) |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> m) |
V |
putIfAbsent(K key,
V value) |
V |
remove(Object key) |
boolean |
remove(Object key,
Object value) |
V |
replace(K key,
V value) |
boolean |
replace(K key,
V oldValue,
V newValue) |
clear, clone, containsValue, entrySet, equals, forEach, getRaw, hashCode, isEmpty, iterator, keySet, replaceAll, size, toString, values
finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public TransMap(Supplier<Map<K,V>> mapFactory)
mapFactory
- 空Map创建工厂public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
containsKey
in class MapWrapper<K,V>
public V getOrDefault(Object key, V defaultValue)
getOrDefault
in interface Map<K,V>
getOrDefault
in class MapWrapper<K,V>
public V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
computeIfPresent
in interface Map<K,V>
computeIfPresent
in class MapWrapper<K,V>
public V putIfAbsent(K key, V value)
putIfAbsent
in interface Map<K,V>
putIfAbsent
in class MapWrapper<K,V>
public V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
computeIfAbsent
in interface Map<K,V>
computeIfAbsent
in class MapWrapper<K,V>
Copyright © 2024. All rights reserved.