commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Parker <thp...@gmail.com>
Subject [collections] ListOrderedMap not respecting underlying list
Date Fri, 10 Jul 2009 01:49:55 GMT

When decorating either CaseInsensitiveMap or IdentityMap (and I believe
this will impact any java.util.TreeMap built with a non-.equals()
Comparator), ListOrderedMap responds inconsistently with the underlying
map.  The ordering seems to be operating off .equals() rather than the
actual contents of the underlying map.

Using CaseInsensitiveMap:
OrderedMap m = ListOrderedMap.decorate(new CaseInsensitiveMap());
m.put("Foo", 1);
m.put("Bar", 2);
m.remove("foo");
//m.firstKey() will return "Foo"

I have JUnit test cases that demonstrate the issue across both
CaseInsensitiveMap and IdentityMap if that would be helpful.

Am I missing something?  Should this be raised as a code issue, or a
documentation enhancement request against ListOrderedMap?

TP.
-- 
Tom Parker
thpr74@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message