[ 
https://issues.apache.org/jira/browse/COLLECTIONS-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12923805#action_12923805
 ] 

Michael Thomas commented on COLLECTIONS-365:
--------------------------------------------

While that is indeed the case, I wonder if this is a good idea: 

A  Set denotes a data structure where no element exists twice (a ListOrderedSet 
one with, well, an order), while a list is a sequence of (possibly) identical, 
ordered elements. Thus semantically a ListOrderedSet is not List and should not 
implement java.util.List - think about the developer who requests a list, gets 
a ListOrderedSet, adds an already existing element and is surprised when the 
size of the list has not changed.

Also mind the technical note in the apidoc of ListOrderedSet:
{quote}This class cannot implement the List interface directly as various 
interface methods (notably equals/hashCode) are incompatable with a set.{quote}

> [collections] ListOrderedSet implementing java.util.List
> --------------------------------------------------------
>
>                 Key: COLLECTIONS-365
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-365
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Set
>    Affects Versions: 3.2
>            Reporter: Dmitry Katsubo
>
> It looks like nothing prevents {{ListOrderedSet}} to implement 
> {{java.util.List}} interface. One need to implement just few methods:
> set(int index, Object element);
> ListIterator listIterator();
> List subList(int fromIndex, int toIndex);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to