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.
NOTE: As from version 3.0, the IteratorChain may contain no iterators. In this case the class will function as an empty iterator.
NOTE: As from version 4.0, the IteratorChain stores the iterators in a queue and removes any reference to them as soon as they are not used anymore. Thus the methods {@code setIterator(Iterator)} and {@code getIterators()} have beenremoved and {@link #size()} will return the number of remaining iterators inthe queue.
@since 2.1
@version $Id: IteratorChain.java 1482514 2013-05-14 18:36:12Z tn $