WeakHashMap

  • It is exactly same as HashMap except below difference:
    • In the case of HashMap, even though object doesn’t have any reference it is not eligible for GC if it is associated with HashMap i.e HashMap dominates GarbageCollector
    • But in the case of weak hashmap if the object doesn’t contain any references, it is eligible for GC even though the object associated with WeakHashMap i.e GarbageCollector dominates WeakHashMap

Leave a Comment