posted 13 years ago
suppose consider this situation : you want to avoid creating duplicate Objects, so when ever you create a new Object you store it in a HashMap[which is static]. if any duplicate value comes then you check this with existing objects and avoiding duplicate object creation. but you dont want to keep a object which is not referenced for certain long time. this is the time to go for WeakHashMap instead of HashMap.