Tim O'Brien wrote:

Wendy, you could most certainly use a LRUMap with a fixed size. Give each item a unique key and let the Map take care of uniqueness. LRUMap will take care of discarding the least recently used entry once it reached the maximum defined size, and the Iterator returns most recently used to least recently used. This would be the easiest way to do this, by far.

Sorry, hit send too quickly, so that code compared to the LRUMap solution:

       Map map = new LRUMap(5);
map.put( "Page 1", "" );
       map.put( "Page 2", "" );
       map.put( "Page 3", "" );
       map.put( "Page 4", "" );
       map.put( "Page 5", "" );
       map.put( "Page 6", "" );
       map.put( "Page 7", "" );
       map.put( "Page 8", "" );
       map.put( "Page 9", "" );
       map.put( "Page 1", "" );

       Iterator i = map.keySet().iterator();
       while (i.hasNext()) {
           String value = (String) i.next();
           System.out.println(value);
       }





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to