org.intermine.util
Class CombinedIterator<E>

java.lang.Object
  extended by org.intermine.util.CombinedIterator<E>
Type Parameters:
E - the element type of the iterator
All Implemented Interfaces:
java.util.Iterator<E>

public class CombinedIterator<E>
extends java.lang.Object
implements java.util.Iterator<E>

An Iterator that combines the contents of various other Iterators. The provided Iterators will be followed one by one, until the last Iterator has no remaining elements.


Field Summary
protected  java.util.Iterator<? extends E> currentIterator
           
protected  java.util.Iterator<java.util.Iterator<? extends E>> iteratorIterator
           
 
Constructor Summary
CombinedIterator(java.util.List<java.util.Iterator<? extends E>> iterators)
          Constructs a CombinedIterator from a List of Iterators.
 
Method Summary
 boolean hasNext()
          
 E next()
          
 void remove()
           This operation is not supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iteratorIterator

protected java.util.Iterator<java.util.Iterator<? extends E>> iteratorIterator

currentIterator

protected java.util.Iterator<? extends E> currentIterator
Constructor Detail

CombinedIterator

public CombinedIterator(java.util.List<java.util.Iterator<? extends E>> iterators)
Constructs a CombinedIterator from a List of Iterators. The provided Iterators should be in a state where the desired elements are present. The act of iterating through this combined iterator will result in the provided Iterators being iterated.

Parameters:
iterators - a List of Iterators to be followed in order
Method Detail

hasNext

public boolean hasNext()

Specified by:
hasNext in interface java.util.Iterator<E>

next

public E next()

Specified by:
next in interface java.util.Iterator<E>

remove

public void remove()
This operation is not supported.

Specified by:
remove in interface java.util.Iterator<E>