Package org.apache.maven.impl.cache
Class Cache.RefConcurrentMap<K,V>
java.lang.Object
org.apache.maven.impl.cache.Cache.RefConcurrentMap<K,V>
- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values
A concurrent map implementation that uses configurable reference types for both keys and values,
and supports automatic cleanup of garbage-collected entries.
This implementation is package-private and accessed through the Cache interface.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.maven.impl.cache.Cache
Cache.EvictionListener, Cache.RefConcurrentMap<K,V>, Cache.ReferenceType -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, Cache.ReferenceType referenceType) Computes a value for the given key if it's not already present, using the specified reference type.booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()Returns the key reference type used by this cache.getName()Returns the cache name for debugging purposes.Returns a string representation of the reference type combination.Returns the value reference type used by this cache.booleanisEmpty()keySet()voidvoidremoveIf(BiPredicate<K, V> filter) voidsetEvictionListener(Cache.EvictionListener listener) Sets an eviction listener to be notified of eviction events.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.Map
compute, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Method Details
-
setEvictionListener
Sets an eviction listener to be notified of eviction events. -
computeIfAbsent
- Specified by:
computeIfAbsentin interfaceCache<K,V> - Specified by:
computeIfAbsentin interfaceMap<K,V>
-
computeIfAbsent
public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, Cache.ReferenceType referenceType) Computes a value for the given key if it's not already present, using the specified reference type.This method allows fine-grained control over the reference type used for individual entries, overriding the map's default reference type for this specific key-value pair.
- Specified by:
computeIfAbsentin interfaceCache<K,V> - Parameters:
key- the key whose associated value is to be returned or computedmappingFunction- the function to compute a valuereferenceType- the reference type to use for this entry (null uses map default)- Returns:
- the current (existing or computed) value associated with the specified key
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceCache<K,V> - Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
get
-
put
-
remove
-
removeIf
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
getKeyReferenceType
Returns the key reference type used by this cache. -
getValueReferenceType
Returns the value reference type used by this cache. -
getReferenceTypeKey
Returns a string representation of the reference type combination. -
getName
Returns the cache name for debugging purposes.
-