Eric,
I'm referring to the current cvs version from
subversions.gnu.org:/cvsroot/classpath .
The other day I needed a lru cache in jython (ie. python implemented in java)
and I found that LinkedHashMap.java would do the job well, except that I'm
currently forced to use java 1.1 and the collections replacement for 1.1 does
not include a LinkedHashMap.
That meant I needed to write a linked hash map with a doubly linked list and
a maximum capacity in python.
With the maximum capacity constraint I found that when implementing
the doubly linked list as a circular list the insertion of a new element when
the cache is full (ie. the normal case) can be implemented nicely by updating
the oldest element and simply moving the list head and tail pointers one
element. This also saves the creation of a new list element.
My question:
Since this is probably a frequent use of LinkedHashMap I wondered whether a
circular list might be a good alternative for the current implementation of
the LinkedHashMap, in which the head and tail elements have their prev and
succ pointers set to null.
Anyway, in case I run into memory problems with my current python
implementation I'm probably going to use your LinkedHashMap class in java 1.1
as it is.
For use as list elements, python objects in java are far too large, they have
an associated dictionary for their fields.
Thanks and regards,
Ype