org.graffiti.util
Class RedundantMultipleIterator<T>

java.lang.Object
  extended by org.graffiti.util.RedundantMultipleIterator<T>
All Implemented Interfaces:
Iterator<T>

public class RedundantMultipleIterator<T>
extends Object
implements Iterator<T>

Class MultipleIterator encapsulates a number of instances implementing the java.util.Iterator interface. It is possible to iterate over all the iterators one after the other.

Version:
$Revision: 5767 $

Constructor Summary
RedundantMultipleIterator(Iterator<T> itr)
          Constructs a new MultipleIterator instance.
RedundantMultipleIterator(Iterator<T>[] iters)
          Constructs a new MultipleIterator instance.
RedundantMultipleIterator(Iterator<T> itr1, Iterator<T> itr2)
          Constructs a new MultipleIterator instance.
RedundantMultipleIterator(Iterator<T> itr1, Iterator<T> itr2, Iterator<T> itr3)
          Constructs a new MultipleIterator instance.
 
Method Summary
 boolean hasNext()
          Returns true if the iteration has not yet passed each of the iterators, false otherwise.
 T next()
          Returns the next element of the iteration.
 void remove()
          The method remove() of the interface java.util.Iterator will not be supported in this implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RedundantMultipleIterator

public RedundantMultipleIterator(Iterator<T>[] iters)
Constructs a new MultipleIterator instance.

Parameters:
iters - the iterators over which to iterate.

RedundantMultipleIterator

public RedundantMultipleIterator(Iterator<T> itr)
Constructs a new MultipleIterator instance.

Parameters:
itr - the iterator over which to iterate.

RedundantMultipleIterator

public RedundantMultipleIterator(Iterator<T> itr1,
                                 Iterator<T> itr2)
Constructs a new MultipleIterator instance.

Parameters:
itr1 - the first iterator over which to iterate.
itr2 - the second iterator over which to iterate.

RedundantMultipleIterator

public RedundantMultipleIterator(Iterator<T> itr1,
                                 Iterator<T> itr2,
                                 Iterator<T> itr3)
Constructs a new MultipleIterator instance.

Parameters:
itr1 - the first iterator over which to iterate.
itr2 - the second iterator over which to iterate.
itr3 - the third iterator over which to iterate.
Method Detail

hasNext

public boolean hasNext()
Returns true if the iteration has not yet passed each of the iterators, false otherwise.

Specified by:
hasNext in interface Iterator<T>
Returns:
true if the iteration has not yet passed each of the iterators, false otherwise.

next

public T next()
Returns the next element of the iteration. If the end of one iterator has been reached, the iteration will be continued on the next one.

Specified by:
next in interface Iterator<T>
Returns:
the next element of the iteration.
Throws:
NoSuchElementException - DOCUMENT ME!

remove

public void remove()
            throws UnsupportedOperationException
The method remove() of the interface java.util.Iterator will not be supported in this implementation.

Specified by:
remove in interface Iterator<T>
Throws:
UnsupportedOperationException - if the method is called.


Generated at 2012-05-30 11:00:36 PM CEST