How to design a software cache in Java using a HashMap?
<p>A HashMap is a logical choice for implementing a software cache because it allows for constant time lookup. But then the logical question is what do we do when the HashMap begins to run out of memory. How do we ensure that "unnecessary" elements are removed from the HashMap? </p>
