Class MildConcurrentKeys<K,​V>

  • All Implemented Interfaces:
    java.util.concurrent.ConcurrentMap<K,​V>, java.util.Map<K,​V>

    final class MildConcurrentKeys<K,​V>
    extends MildKeys<K,​V>
    implements java.util.concurrent.ConcurrentMap<K,​V>
    Thread-safe Map whose keys are kept alive by soft/weak References.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.concurrent.ConcurrentMap<java.lang.ref.Reference<K>,​V> concurrentMap  
    • Constructor Summary

      Constructors 
      Constructor Description
      MildConcurrentKeys​(java.util.concurrent.ConcurrentMap<java.lang.ref.Reference<K>,​V> map, boolean soft)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      V putIfAbsent​(K key, V value)  
      boolean remove​(java.lang.Object key, java.lang.Object value)  
      V replace​(K key, V value)  
      boolean replace​(K key, V oldValue, V newValue)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.concurrent.ConcurrentMap

        compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
      • Methods inherited from interface java.util.Map

        clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
    • Field Detail

      • concurrentMap

        private final java.util.concurrent.ConcurrentMap<java.lang.ref.Reference<K>,​V> concurrentMap
    • Constructor Detail

      • MildConcurrentKeys

        MildConcurrentKeys​(java.util.concurrent.ConcurrentMap<java.lang.ref.Reference<K>,​V> map,
                           boolean soft)
    • Method Detail

      • putIfAbsent

        public V putIfAbsent​(K key,
                             V value)
        Specified by:
        putIfAbsent in interface java.util.concurrent.ConcurrentMap<K,​V>
        Specified by:
        putIfAbsent in interface java.util.Map<K,​V>
      • replace

        public V replace​(K key,
                         V value)
        Specified by:
        replace in interface java.util.concurrent.ConcurrentMap<K,​V>
        Specified by:
        replace in interface java.util.Map<K,​V>
      • replace

        public boolean replace​(K key,
                               V oldValue,
                               V newValue)
        Specified by:
        replace in interface java.util.concurrent.ConcurrentMap<K,​V>
        Specified by:
        replace in interface java.util.Map<K,​V>
      • remove

        public boolean remove​(java.lang.Object key,
                              java.lang.Object value)
        Specified by:
        remove in interface java.util.concurrent.ConcurrentMap<K,​V>
        Specified by:
        remove in interface java.util.Map<K,​V>