Real title: Caches and guaranteed-order Hashtables etc - the easy way (Sorry; this forum system sucks: short maximum topic-name length!).
Java now has support for very easy-to-make LRU-caches. It also provides a very simple way of making ANY Collection always iterate its contents in the same order (kind of ;). Yet another reason to upgrade to 1.4, I’m afraid ;).
I was developing with 1.4 for several months before I realised this had been added - it doesn’t seem to have got much press alongside NBIO, regexp’s, XML parsers, etc. Hence I thought I’d bring it to people’s attention.
It’s all provided by a new class within java.util.*: LinkedHashMap. The API docs have full instructions on how to use it in both ways; if you have any difficulty, let me know and I’ll try and help (I frequently need caches for various things, and ditto with iteration-order-preservation, so I’ve used it quite a bit by this point).