ManagedIdentityConcurrentMap (Groovy 5.0.6)
Description: declaration: package: org.apache.groovy.util.concurrent, class: ManagedIdentityConcurrentMap

Package org.apache.groovy.util.concurrent

# 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 type
  `V` - 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 on `ConcurrentReferenceHashMap`, 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>`

  ## Nested classes/interfaces inherited from interface java.util.Map

  `Map.Entry<K extends Object,V extends Object>`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ManagedIdentityConcurrentMap()`
  Creates a new, empty map with the key weak reference
  `ManagedIdentityConcurrentMap(int initialCapacity)`
  Creates a new, empty map with the key weak reference and the specified initial capacity
  `ManagedIdentityConcurrentMap(ConcurrentReferenceHashMap.ReferenceType keyType)`
  Creates a new, empty map with the specified key reference type
  `ManagedIdentityConcurrentMap(ConcurrentReferenceHashMap.ReferenceType keyType, int initialCapacity)`
  Creates a new, empty map with the specified key reference type and initial capacity

- ## Method Summary

  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 Details

  - ### 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 type
      `initialCapacity` - the initial capacity

- ## Method Details

  - ### getOrPut

    public V getOrPut(K key, V value)
    Get the key specified value, or put the default value and return it if the key is absent
    Parameters:
      `key` - the key to look up
      `value` - the default value if the key is absent
    Returns:
      the value