You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jochen Wiedmann (JIRA)" <ji...@apache.org> on 2011/03/08 22:36:00 UTC

[jira] Resolved: (COLLECTIONS-332) ListOrderedMap not respecting underlying list

     [ https://issues.apache.org/jira/browse/COLLECTIONS-332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jochen Wiedmann resolved COLLECTIONS-332.
-----------------------------------------

       Resolution: Fixed
    Fix Version/s: 3.2.2

Added the following comment on ListOrderedMap:

*Note* that ListOrderedMap doesn't work with {{IdentityMap}},
{{CaseInsensitiveMap}}, or similar maps that violate the general
contract of {{Map}}. The {{ListOrderedMap}} (or, more precisely,
the underlying {{List}}) is relying on {{equals()}}. This is
fine, as long as the decorated {{Map}} is also based on
{{equals()}}, and {{hashCode()}}, which {{IdentityMap}}, and
{{CaseInsensitiveMap}} don't: The former uses {{==}}, and
the latter uses {{equals()}} on a lowercased key.

Added the following to IdentityMap, and CaseInsensitiveMap:

*Note* This map will violate the detail of various Map and map view
contracts. As a general rule, don't compare this map to other
maps. In particular, you can't use decorators like
{{ListOrderedMap}} on it, which silently assume that these
contracts are fulfilled.


> ListOrderedMap not respecting underlying list
> ---------------------------------------------
>
>                 Key: COLLECTIONS-332
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-332
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Map
>            Reporter: Tom Parker
>            Priority: Minor
>             Fix For: 3.2.2
>
>         Attachments: ListOrderedMapTest.java
>
>
> 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. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira