title: How to set max size in Java TreeMap?
body: <p>I am building an Least Recently Used Cache using a TreeMap in Java. The reason I selected the TreeMap is because of the TreeMap.floorEntry (String) method.
  I want to be able to specify a maximum size for my cache(TreeMap).
  Then I want to use an LRU eviction mechanism, and therefore,
  When the cache has reached the maximum size AND when there is a new record to be cached, 
  I want the cache to add the new record, and remove the eldest entry. </p>