You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Paul Libbrecht <pa...@activemath.org> on 2006/07/01 23:45:06 UTC
[collections] IteratorChain(Iterator) should be meta!
Hello,
only after a looong quest I realized that new IteratorChain(Iterator)
will only iterate through the elements of the given iterator instead of
expecting that each element is an iterator itself through which one
iterates.
Am I blurred to expect such ?
I suppose that changing this behaviour would be a too strong API
change... so should one do an IteratorThroughIterators?? I can offer a
class... if wished.
paul
Re: [collections] IteratorChain(Iterator) should be meta!
Posted by Stephen Colebourne <sc...@btopenworld.com>.
IteratorChain is the right class, but the constructor just adds the one
iterator.
You could use the Iterator(Collection) constructor which adds a
collection of Iterators. Perhaps use IteratorUtils.toList to create the
list?
Alternatively, you could patch IteratorChain to add a factory method
that takes an iterator and does what you wanted.
Stephen
Paul Libbrecht wrote:
>
> Hello,
>
> only after a looong quest I realized that new IteratorChain(Iterator)
> will only iterate through the elements of the given iterator instead of
> expecting that each element is an iterator itself through which one
> iterates.
>
> Am I blurred to expect such ?
> I suppose that changing this behaviour would be a too strong API
> change... so should one do an IteratorThroughIterators?? I can offer a
> class... if wished.
>
> paul
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [collections] IteratorChain(Iterator) should be meta!
Posted by paul womack <pw...@papermule.co.uk>.
Paul Libbrecht wrote:
>
> Hello,
>
> only after a looong quest I realized that new IteratorChain(Iterator)
> will only iterate through the elements of the given iterator instead of
> expecting that each element is an iterator itself through which one
> iterates.
>
> Am I blurred to expect such ?
> I suppose that changing this behaviour would be a too strong API
> change... so should one do an IteratorThroughIterators?? I can offer a
> class... if wished.
I think what you want can be handled nicely by
the (remarkable) ObjectGraphIterator class.
BugBear
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org