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 TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanprotected voidCheck for and remove references from the map which have become cleared.org.web3d.util.KeyedWeakReferenceinthashCode()booleanisEmpty()keySet()org.web3d.util.KeyedWeakReferencevoidorg.web3d.util.KeyedWeakReferenceintsize()Collection<org.web3d.util.KeyedWeakReference> values()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods 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:
containsKeyin interfaceMap<Object,org.web3d.util.KeyedWeakReference> - See Also:
-
containsValue
- Specified by:
containsValuein 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
-