[DISCUSSION] LinkedHashMap iteration order.

Paulo Levi i30817 at gmail.com
Wed Jul 25 18:29:08 UTC 2007

The LinkedHashMap seems like a nice class for implementing a LRU map, and it
However when you try to use it to actually access the most recently used
<key, value> with the appropriate constructor, its easy to see that the
order of iteration is from the least recently used to the most recently

To access the most recent item you must either iterate over n keys or
toArray() (even worse).

Is there another easy solution in java 1.5 (in the collections framework)?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20070725/b2f80846/attachment.html>

More information about the core-libs-dev mailing list