Class WeakConcurrentMap.WithInlinedExpunction<K,V>

java.lang.Object
java.lang.ref.ReferenceQueue<K>
cn.nukkit.utils.collection.WeakConcurrentMap<K,V>
cn.nukkit.utils.collection.WeakConcurrentMap.WithInlinedExpunction<K,V>
All Implemented Interfaces:
Iterable<Map.Entry<K,V>>, Runnable
Enclosing class:
WeakConcurrentMap<K,V>

public static class WeakConcurrentMap.WithInlinedExpunction<K,V> extends WeakConcurrentMap<K,V>
A WeakConcurrentMap where stale entries are removed as a side effect of interacting with this map.
  • Constructor Details

    • WithInlinedExpunction

      public WithInlinedExpunction()
  • Method Details

    • get

      public V get(K key)
      Overrides:
      get in class WeakConcurrentMap<K,V>
      Parameters:
      key - The key of the entry.
      Returns:
      The value of the entry or the default value if it did not exist.
    • containsKey

      public boolean containsKey(K key)
      Overrides:
      containsKey in class WeakConcurrentMap<K,V>
      Parameters:
      key - The key of the entry.
      Returns:
      true if the key already defines a value.
    • put

      public V put(K key, V value)
      Overrides:
      put in class WeakConcurrentMap<K,V>
      Parameters:
      key - The key of the entry.
      value - The value of the entry.
      Returns:
      The previous entry or null if it does not exist.
    • remove

      public V remove(K key)
      Overrides:
      remove in class WeakConcurrentMap<K,V>
      Parameters:
      key - The key of the entry.
      Returns:
      The removed entry or null if it does not exist.
    • iterator

      public Iterator<Map.Entry<K,V>> iterator()
      Specified by:
      iterator in interface Iterable<K>
      Overrides:
      iterator in class WeakConcurrentMap<K,V>
    • approximateSize

      public int approximateSize()
      Description copied from class: WeakConcurrentMap
      Returns the approximate size of this map where the returned number is at least as big as the actual number of entries.
      Overrides:
      approximateSize in class WeakConcurrentMap<K,V>
      Returns:
      The minimum size of this map.