Package org.aoju.bus.core.map
Class ReferenceMap<K,V>
java.lang.Object
org.aoju.bus.core.map.ReferenceMap<K,V>
- Type Parameters:
K- 键类型V- 值类型
- All Implemented Interfaces:
Serializable,Iterable<Map.Entry<K,,V>> ConcurrentMap<K,,V> Map<K,V>
- Direct Known Subclasses:
WeakMap
public class ReferenceMap<K,V>
extends Object
implements ConcurrentMap<K,V>, Iterable<Map.Entry<K,V>>, Serializable
线程安全的ReferenceMap实现 参考:jdk.management.resource.internal.WeakKeyConcurrentHashMap
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescriptionReferenceMap(ConcurrentMap<Reference<K>, V> raw, References.Type referenceType) 构造 -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()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()voidforEach(BiConsumer<? super K, ? super V> action) booleanisEmpty()iterator()keySet()voidputIfAbsent(K key, V value) booleanbooleanvoidreplaceAll(BiFunction<? super K, ? super V, ? extends V> function) voidsetPurgeListener(BiConsumer<Reference<? extends K>, V> purgeListener) 设置对象回收清除监听intsize()values()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.ConcurrentMap
getOrDefaultMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ReferenceMap
构造- Parameters:
raw-ConcurrentMap实现referenceType- Reference类型
-
-
Method Details
-
setPurgeListener
设置对象回收清除监听- Parameters:
purgeListener- 监听函数
-
size
-
isEmpty
-
get
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
put
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
putIfAbsentin interfaceMap<K,V>
-
putAll
-
replace
-
replace
-
replaceAll
- Specified by:
replaceAllin interfaceConcurrentMap<K,V> - Specified by:
replaceAllin interfaceMap<K,V>
-
computeIfAbsent
- Specified by:
computeIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
computeIfAbsentin interfaceMap<K,V>
-
computeIfPresent
- Specified by:
computeIfPresentin interfaceConcurrentMap<K,V> - Specified by:
computeIfPresentin interfaceMap<K,V>
-
remove
-
remove
-
clear
-
keySet
-
values
-
entrySet
-
forEach
-
iterator
-
compute
-
merge
-