IdentityHashMap and WeakHashMap ?

IdentityHashMap is exactly same as HashMap except the following difference.
    In the HashMap JVM uses equals() method to identify duplicate keys  but in the  case of IdentityHashMap JVM uses == operator for this.
WeakHashMap 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 doesn't 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 garbage collection even though it is associated with weakHashMap.  ie  garbage collector dominates WeakHashMap

1 comment:

  1. You can wipe out your opponents. But if you do it unjustly you become eligible for being wiped out yourself.
    See the link below for more info.

    #eligible
    www.ufgop.org

    ReplyDelete