Package one.pkg.tinyutils.map
Class WeakLongHashMap<V>
java.lang.Object
one.pkg.tinyutils.map.WeakLongHashMap<V>
- Type Parameters:
V- the type of mapped values
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all of the mappings from this map.booleancontainsKey(long key) Returnstrueif this map contains a mapping for the specified key.get(long key) Returns the value to which the specified key is mapped, ornullif this map contains no mapping for the key.booleanisEmpty()Returnstrueif this map contains no key-value mappings.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.intsize()Returns the number of key-value mappings in this map.
-
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()Returnstrueif this map contains no key-value mappings. -
get
Returns the value to which the specified key is mapped, ornullif this map contains no mapping for the key. -
put
Associates the specified value with the specified key in this map. -
remove
Removes the mapping for a key from this map if it is present. -
containsKey
public boolean containsKey(long key) Returnstrueif this map contains a mapping for the specified key. -
clear
public void clear()Removes all of the mappings from this map.
-