Class ManagedIdentityConcurrentMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- org.apache.groovy.util.concurrent.ConcurrentReferenceHashMap<K,V>
-
- org.apache.groovy.util.concurrent.ManagedIdentityConcurrentMap<K,V>
-
- Type Parameters:
K
- the key typeV
- the value type
- All Implemented Interfaces:
Serializable
,Map<K,V>
public class ManagedIdentityConcurrentMap<K,V> extends ConcurrentReferenceHashMap<K,V>
This is a basic implementation of a map able to forget its keys could be weak/soft/strong references. This bases onConcurrentReferenceHashMap
, thus it is safe for concurrency. This map compares keys through references.- Since:
- 4.0.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.groovy.util.concurrent.ConcurrentReferenceHashMap
ConcurrentReferenceHashMap.HashIterator, ConcurrentReferenceHashMap.InitializableEntry<K,V>, ConcurrentReferenceHashMap.Option, ConcurrentReferenceHashMap.ReferenceType, ConcurrentReferenceHashMap.SimpleEntry<K,V>, ConcurrentReferenceHashMap.WriteThroughEntry
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description ManagedIdentityConcurrentMap()
Creates a new, empty map with the key weak referenceManagedIdentityConcurrentMap(int initialCapacity)
Creates a new, empty map with the key weak reference and the specified initial capacityManagedIdentityConcurrentMap(ConcurrentReferenceHashMap.ReferenceType keyType)
Creates a new, empty map with the specified key reference typeManagedIdentityConcurrentMap(ConcurrentReferenceHashMap.ReferenceType keyType, int initialCapacity)
Creates a new, empty map with the specified key reference type and initial capacity
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description V
getOrPut(K key, V value)
Get the key specified value, or put the default value and return it if the key is absent-
Methods inherited from class org.apache.groovy.util.concurrent.ConcurrentReferenceHashMap
apply, applyIfAbsent, applyIfPresent, cachedEntrySet, clear, contains, containsKey, containsValue, elements, entrySet, get, hashOf, isEmpty, keys, keySet, purgeStaleEntries, put, putAll, putIfAbsent, remove, remove, replace, replace, size, values
-
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
-
-
-
-
Constructor Detail
-
ManagedIdentityConcurrentMap
public ManagedIdentityConcurrentMap()
Creates a new, empty map with the key weak reference
-
ManagedIdentityConcurrentMap
public ManagedIdentityConcurrentMap(int initialCapacity)
Creates a new, empty map with the key weak reference and the specified initial capacity- Parameters:
initialCapacity
- initial capacity
-
ManagedIdentityConcurrentMap
public ManagedIdentityConcurrentMap(ConcurrentReferenceHashMap.ReferenceType keyType)
Creates a new, empty map with the specified key reference type- Parameters:
keyType
- key reference type
-
ManagedIdentityConcurrentMap
public ManagedIdentityConcurrentMap(ConcurrentReferenceHashMap.ReferenceType keyType, int initialCapacity)
Creates a new, empty map with the specified key reference type and initial capacity- Parameters:
keyType
- key reference typeinitialCapacity
- the initial capacity
-
-