You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas Neidhart (JIRA)" <ji...@apache.org> on 2015/11/27 22:48:13 UTC

[jira] [Closed] (COLLECTIONS-309) IteratorChain should include factory methods for decorating iterator lists and arrays into locked IteratorChain.

     [ 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)