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=29519>. 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=29519 DualTreeBidiMap does not sort with custom Comparator Summary: DualTreeBidiMap does not sort with custom Comparator Product: Commons Version: 3.0 Final Platform: Other OS/Version: Other Status: NEW Severity: Major Priority: Other Component: Collections AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] When you supply a Comparator to the constructor of DualTreeBidiMap, the custom sorting order is NOT maintained. The problem lies in the order where protected Map createMap() is called: The constructors in AbstractDualBidiMap call this metod, but the comparator is set *after* calling super() in DualTreeBidiMap: //--- Class AbstractDualBidiMap---// protected AbstractDualBidiMap() { super(); maps[0] = createMap(); maps[1] = createMap(); } //--- Class DualTreeBidiMap ---// public DualTreeBidiMap(Comparator comparator) { super(); this.comparator = comparator; // <-- Too late, createMap already called! } protected Map createMap() { return new TreeMap(comparator); // <-- Comparator always null } Hence, DualTreeBidiMap.compatator() always returns null. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
