Are you asking why Map doesn't extend Collection? A Map is a collection of bindings from key to value, so there are always two elements involved (key and value). You can get collections of the keys, the values, and the bindings from the Map, though, if you need to treat those as Collection.
What is THashMap? and how it is benificial compared to HashMap?
WeakHashMap which is subtype of HashMap contains a weak object references. weak object reference means It will not wait till garbage collector come and cleans when there is a no reference present it will be deleted immediately.
That's a bit confusing or maybe incorrect. Removal will always "wait for the garbage collector" because that's what removes objects from memory.
WeakHashMap says: An entry in a WeakHashMap will automatically be removed when its key is no longer in ordinary use. And once the key is gone, it removes the whole MapEntry. So when you put something in a WeakHashMap it will stay there as long as there is a strong reference to the key somewhere.
The map itself makes only a WeakReference to the key. WeakReference says when the GC finds that all references to an object are weak, it will make the object eligible for collection by breaking all the references.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com