commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dipanjan Laha (JIRA)" <>
Subject [jira] [Commented] (COLLECTIONS-533) Add a MultiValuedLinkedHashMap to preserve insertion order
Date Mon, 20 Oct 2014 12:45:33 GMT


Dipanjan Laha commented on COLLECTIONS-533:

Sorry I missed this earlier, but there is an issue with this implementation of just wrapping
a LinkedHashMap to get a MultiValuedLinkedHashMap.
The order of insertion will not be maintained across different keys. For example, in the code

    MultiValuedMap<String, String> map = new MultiValuedLinkedHashMap<>();
    map.put((K)"a", (V)"a1");
    map.put((K)"b", (V)"b1");
    map.put((K)"a", (V)"a2");

    MapIterator<String, String> mapIt = map.mapIterator();

the map iterator will not follow the insertion order and would return \{a,a1}, \{a,a2} &
\{b,b1} in order.

imho to get the correct behaviour we would need to implement the functionality (maintaining
a DoubleLinkedList) over MultiValuedHashMap instead of just wrapping LinkedHashMap.
Or if anyone can suggest an easier way to do this.

> Add a MultiValuedLinkedHashMap to preserve insertion order
> ----------------------------------------------------------
>                 Key: COLLECTIONS-533
>                 URL:
>             Project: Commons Collections
>          Issue Type: New Feature
>          Components: Map
>            Reporter: Benedikt Ritter
>              Labels: github
> Placeholder ticket for

This message was sent by Atlassian JIRA

View raw message