Class WeakLongHashMap<V>

java.lang.Object
one.pkg.tinyutils.map.WeakLongHashMap<V>
Type Parameters:
V - the type of mapped values

public class WeakLongHashMap<V> extends Object
A Map-like data structure that uses primitive long keys and weakly references its values. Similar to WeakHashMap, an entry is automatically removed when its value is no longer ordinarily reachable.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    WeakLongHashMap(int expected)
     
    WeakLongHashMap(int expected, float f)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Removes all of the mappings from this map.
    boolean
    containsKey(long key)
    Returns true if this map contains a mapping for the specified key.
    get(long key)
    Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
    boolean
    Returns true if this map contains no key-value mappings.
    put(long key, V value)
    Associates the specified value with the specified key in this map.
    remove(long key)
    Removes the mapping for a key from this map if it is present.
    int
    Returns the number of key-value mappings in this map.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WeakLongHashMap

      public WeakLongHashMap()
    • WeakLongHashMap

      public WeakLongHashMap(int expected)
    • WeakLongHashMap

      public WeakLongHashMap(int expected, float f)
  • Method Details

    • size

      public int size()
      Returns the number of key-value mappings in this map.
    • isEmpty

      public boolean isEmpty()
      Returns true if this map contains no key-value mappings.
    • get

      @Nullable public V get(long key)
      Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
    • put

      public V put(long key, V value)
      Associates the specified value with the specified key in this map.
    • remove

      public V remove(long key)
      Removes the mapping for a key from this map if it is present.
    • containsKey

      public boolean containsKey(long key)
      Returns true if this map contains a mapping for the specified key.
    • clear

      public void clear()
      Removes all of the mappings from this map.