commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (COLLECTIONS-309) IteratorChain should include factory methods for decorating iterator lists and arrays into locked IteratorChain.
Date Fri, 27 Nov 2015 21:48:13 GMT

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

Thomas Neidhart closed COLLECTIONS-309.
---------------------------------------

> IteratorChain should include factory methods for decorating iterator lists and arrays
into locked IteratorChain.
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: COLLECTIONS-309
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-309
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Iterator
>    Affects Versions: 3.2
>         Environment: n/a
>            Reporter: ori
>            Priority: Minor
>
> IteratorChain should not instantiate an ArrayList for every new instance.
> A private constructor taking a list should be added.
> Then we can add static factory methods for decorating a list of iterators to produce
a locked chain:
>     public static IteratorChain decorate( List iterators )
>     {
>         final IteratorChain chain = new IteratorChain( iterators );
>         chain.lockChain();
>         return chain;
>     }
>     private IteratorChain( List iteratorChain )
>     {
>         this.iteratorChain = iteratorChain;
>     }
>     public IteratorChain()
>     {
>         this( new ArrayList() );
>     }
> Some other observations:
> 1. There's a copy/paste mistake in the comment above the isLocked member declaration
(it says ComparatorChain is "locked" after the first time compare(Object,Object) is called).
> 2. It's probably impossible to change now but the naming/semantics of IteratorChain,
ComparatorChain, and ChainedTransformer should all be identical. There's a lot of duplicated
functionality among these 3 classes.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message