Gosh I had right now a hell of an interview. No matter how much you prepare you go in and forget everything. :)
I thought I would share the question while it's fresh in my mind.
1) You have 1000 objects hold as a cache. You are supposed to create the cache in an efficient manner so that the search time is very short.
Obviously they were looking for a HashSet that provides constant access time.
2) How to get the object within the cache that was least (not oldest but least) used? What to use as hashcode to achieve this, and how to get this bucket without doing any expensive searching?
I was thinking to use the timestamp of the objects as a hashcode. But how would I get the least used object without doing any search?