What is WeakHashMap?

It is exactly same as HashMap except the following difference.
In case of HashMap an Object is not eligible for garbage collection if it is associated with HashMap even though it dosent have any external references. ie HashMap dominates garbage collector.
But in case of WeakHashMap , if an Object is not having any external references then it is always eligible for garabage collection even though it is associated with weakHashMap. ie garbage collector dominates WeakHashMap

No comments:

Post a Comment