org.optaplanner.core.impl.domain.common

## Class ConcurrentMemoization<K,V>

- java.lang.Object
- - java.util.AbstractMap<K,V>
  - - java.util.concurrent.ConcurrentHashMap<K,V>
    - - org.optaplanner.core.impl.domain.common.ConcurrentMemoization<K,V>

- Type Parameters:
    `K` - the parameter of the calculation
    `V` - the result of the calculation
  All Implemented Interfaces:
    Serializable, ConcurrentMap<K,V>, Map<K,V>

      public final class ConcurrentMemoization<K,V>
      extends ConcurrentHashMap<K,V>

  A thread-safe memoization that caches a calculation.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.util.concurrent.ConcurrentHashMap

      `ConcurrentHashMap.KeySetView<K,V>`

    - ### Nested classes/interfaces inherited from class java.util.AbstractMap

      `AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>`

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

      `Map.Entry<K,V>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConcurrentMemoization()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `V` | `computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)` An overridden implementation that heavily favors read access over write access speed.

    - ### Methods inherited from class java.util.concurrent.ConcurrentHashMap

      `clear, compute, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, put, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, values`

    - ### Methods inherited from class java.util.AbstractMap

      `clone`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ConcurrentMemoization

          public ConcurrentMemoization()

  - ### Method Detail

    - #### computeIfAbsent

          public V computeIfAbsent(K key,
                                   Function<? super K,? extends V> mappingFunction)

      An overridden implementation that heavily favors read access over write access speed. This is thread-safe.
      Specified by:
        `computeIfAbsent` in interface `ConcurrentMap<K,V>`
      Specified by:
        `computeIfAbsent` in interface `Map<K,V>`
      Overrides:
        `computeIfAbsent` in class `ConcurrentHashMap<K,V>`

Copyright © 2006–2020 JBoss by Red Hat. All rights reserved.