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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.