From the javadoc of LRUMap:
"The orderedMapIterator() method provides direct access to a bidirectional
iterator. The iterators from the other views can also be cast to
OrderedIterator if required."
I was wondering how to actually do this. If I have the following code:
Original code:
LRUMap map = new LRUMap();
I would get a key from this map via an OrderedIterator
OrderedIterator iter = map.orderedMapIterator();
while(iter.hasPrevious())
{
Long id = (Long) iter.previous();
}
New code:
Now if I use synchronizedMap, which forces me to use the Map interface like:
Map map = Collections.synchronizedMap(new LRUMap());
which iterator from which function do I cast in order to get the same
behavior as above?
OrderedMapIterator iter = (OrderedMapIterator) map.entrySet().iterator();
or maybe
OrderedMapIterator iter = (OrderedMapIterator) map.keySet().iterator();
or perhaps something completely different. The documentation is a little
vague on how to accomplish this.
Thanks.