org.springframework.util
Class CompositeIterator<E>

java.lang.Object
  extended by org.springframework.util.CompositeIterator<E>
All Implemented Interfaces:
Iterator<E>

public class CompositeIterator<E>
extends Object
implements Iterator<E>

Iterator that combines multiple other iterators. This implementation maintains a list of iterators which are invoked in sequence until all iterators are exhausted.

Author:
Erwin Vervaet

Constructor Summary
CompositeIterator()
          Create a new composite iterator.
 
Method Summary
 void add(Iterator<E> iterator)
          Add given iterator to this composite.
 boolean hasNext()
           
 E next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeIterator

public CompositeIterator()
Create a new composite iterator. Add iterators using the add(Iterator) method.

Method Detail

add

public void add(Iterator<E> iterator)
Add given iterator to this composite.


hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<E>

next

public E next()
Specified by:
next in interface Iterator<E>

remove

public void remove()
Specified by:
remove in interface Iterator<E>