Grokking Java Interview Questions
Vote

0% completed

​

HashSet, LinkedHashMap, and an LRU Cache

An online grocery store shows each customer the last three products that the customer viewed. The program keeps three entries in memory for this purpose. When a fourth product is viewed, the program removes the entry that has been unused for the longest time. A structure of fixed size that removes the entry used least recently is called an LRU cache, where LRU means least recently used.

Java has no class with that name, but two classes that are built on HashMap supply the parts. The questions below start with HashSet, which stores its elements in a `HashMap

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content