org.graffiti.util
Class MultipleIterator<T>

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

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

Class UniqueMultipleIterator 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
MultipleIterator(Collection<Iterator<T>> iters)
          Constructs a new UniqueMultipleIterator instance.
MultipleIterator(Iterator<T> itr)
          Constructs a new UniqueMultipleIterator instance.
MultipleIterator(Iterator<T> itr1, Iterator<T> itr2)
          Constructs a new UniqueMultipleIterator instance.
MultipleIterator(Iterator<T> itr1, Iterator<T> itr2, Iterator<T> itr3)
          Constructs a new UniqueMultipleIterator 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

MultipleIterator

public MultipleIterator(Collection<Iterator<T>> iters)
Constructs a new UniqueMultipleIterator instance.

Parameters:
iters - the iterators over which to iterate.

MultipleIterator

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

Parameters:
itr - the iterator over which to iterate.

MultipleIterator

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

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

MultipleIterator

public MultipleIterator(Iterator<T> itr1,
                        Iterator<T> itr2,
                        Iterator<T> itr3)
Constructs a new UniqueMultipleIterator 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.

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