Package org.web3d.util
Class WeakValueHashMap
java.lang.Object
org.web3d.util.WeakValueHashMap
public class WeakValueHashMap
extends Object
implements Map<Object,org.web3d.util.KeyedWeakReference>
An extension of HashMap which stored weak references to the values
in the hash map.
Like it says in the documentation for WeakHashMap, this class breaks several immutability assumptions that are assumed for HashMap, since values will be disappearing at random.
- Version:
- $Revision: 1.2 $
- Author:
- Brad Vender
-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new map of default sizeWeakValueHashMap
(int size) Construct a new map with specified starting size -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
protected void
Check for and remove references from the map which have become cleared.org.web3d.util.KeyedWeakReference
int
hashCode()
boolean
isEmpty()
keySet()
org.web3d.util.KeyedWeakReference
void
org.web3d.util.KeyedWeakReference
int
size()
Collection
<org.web3d.util.KeyedWeakReference> values()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
WeakValueHashMap
public WeakValueHashMap()Construct a new map of default size -
WeakValueHashMap
public WeakValueHashMap(int size) Construct a new map with specified starting size- Parameters:
size
-
-
-
Method Details
-
clear
-
containsKey
- Specified by:
containsKey
in interfaceMap<Object,
org.web3d.util.KeyedWeakReference> - See Also:
-
containsValue
- Specified by:
containsValue
in interfaceMap<Object,
org.web3d.util.KeyedWeakReference> - See Also:
-
entrySet
-
equals
-
flushEmptyReferences
protected void flushEmptyReferences()Check for and remove references from the map which have become cleared. -
get
-
hashCode
-
isEmpty
-
keySet
-
put
-
putAll
-
remove
-
size
-
values
-