Hi All
As per my analysis, we can use WeakHashMap to solve these type of
problems but we should carefully choose to use WeakHashMap. If some of
our data is static then we should not use them at any cost because
using them will loose the track of static data and we have to make
another call to retreive the same.
Also that depends on whether the memory is more important or
performance is our concern. For dynamic data we can surely use
WeakHashMaps.
Sometimes WeakHashMaps does not suffice as for for example in Scenario
#2, to implement Cache we can not blindly rely on WeakHashMaps and
should rather use simple HashMaps with LRU data structure implemented.
What are your opinions about my comments?