An IteratorChain is an Iterator that wraps a number of Iterators.
This class makes multiple iterators look like one to the caller When any
method from the Iterator interface is called, the IteratorChain will delegate
to a single underlying Iterator. The IteratorChain will invoke the Iterators
in sequence until all Iterators are exhausted.
Under many circumstances, linking Iterators together in this manner is more
efficient (and convenient) than reading out the contents of each Iterator
into a List and creating a new Iterator.
Calling a method that adds new Iterator after a method in the Iterator
interface has been called will result in an
UnsupportedOperationException. Subclasses should take care to not
alter the underlying List of Iterators.
NOTE: As from version 3.0, the IteratorChain may contain no iterators. In
this case the class will function as an empty iterator.
since: Commons Collections 2.1 version: $Revision: 1.1 $ $Date: 2005/07/26 01:06:32 $ author: Morgan Delagrange author: Stephen Colebourne |