Package: org.apache.groovy.util.concurrent

## [Java] Class ManagedIdentityConcurrentMap<K, V>

- org.apache.groovy.util.concurrent.ManagedIdentityConcurrentMap

-     public class ManagedIdentityConcurrentMap<K, V>
      extends ConcurrentReferenceHashMap

  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.

  Type Parameters:
    `K` - the key type
    `V` - the value type
  Since:
    4.0.0

- - ### Constructor Summary

    Constructors
    Constructor and 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

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `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

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class ConcurrentReferenceHashMap` | `apply, applyIfAbsent, applyIfPresent, cachedEntrySet, clear, contains, containsKey, containsValue, elements, entrySet, get, hashOf, isEmpty, keySet, keys, purgeStaleEntries, put, putAll, putIfAbsent, remove, remove, replace, replace, size, values`

- - ### Constructor Detail

    - #### public ManagedIdentityConcurrentMap()

      Creates a new, empty map with the key weak reference

    - #### public ManagedIdentityConcurrentMap(int initialCapacity)

      Creates a new, empty map with the key weak reference and the specified initial capacity

      Parameters:
        `initialCapacity` - initial capacity

    - #### public ManagedIdentityConcurrentMap(ConcurrentReferenceHashMap.ReferenceType keyType)

      Creates a new, empty map with the specified key reference type

      Parameters:
        `keyType` - key reference type

    - #### 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 Detail

    - #### 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