WeakHashMap Class : WeakHashMap « Collections « Java Tutorial






If the Java memory manager no longer has a strong reference to the object specified as a key, then the entry in the map will be removed.

Creating a WeakHashMap: The four constructors of WeakHashMap are the same as HashMap

public WeakHashMap()
public WeakHashMap(int initialCapacity)
public WeakHashMap(int initialCapacity, float loadFactor)
public WeakHashMap(Map map)








9.31.WeakHashMap
9.31.1.WeakHashMap Class
9.31.2.Understanding Weak References
9.31.3.Demonstrating the WeakHashMap
9.31.4.Create a WeakHashMap with a single element in it
9.31.5.To enable automatically release of the value, the value must be wrapped in a WeakReference object
9.31.6.Implements a combination of WeakHashMap and IdentityHashMap