What is a WeakHashMap and when to use it? [duplicate]
Elements in a weak hashmap can be reclaimed by the garbage collector if there are no other strong references to the key object, this makes them useful for caches/lookup storage. Weak reference are not restricted to these hash tables, you can use WeakReference for single objects. They are useful to save resource, you can keep … Read more