DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28433>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28433

LRUMap.removeLRU(LinkEntry) is passed wrong link entry

           Summary: LRUMap.removeLRU(LinkEntry) is passed wrong link entry
           Product: Commons
           Version: 3.0 Final
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Collections
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The following program attempts to add 3 entries (a,b,c) to an LRUMap with max 
size two.

The contents of the LRUMap are always correct but when the LRUMap fills up it 
removes entry "a" but passes entry "b" to the removeLRU method.

run:
     [java] [a]
     [java] [a, b]
     [java] Remove lru b
     [java] [b, c]

import org.apache.commons.collections.map.LRUMap;

public class LRUMapTest {
    public static void main (String[] args) {
        LRUMap map = new LRUMap(2) {
                protected boolean removeLRU(LinkEntry entry) {
                    System.out.println("Remove lru "+entry.getKey());
                    return true;
                }
            };
        map.put("a","a");
        System.out.println(map.keySet());
        map.put("b","b");
        System.out.println(map.keySet());
        map.put("c","c");
        System.out.println(map.keySet());
    }
}

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

Reply via email to