Package org.graffiti.util
Class MultipleIterator
java.lang.Object
org.graffiti.util.MultipleIterator
- All Implemented Interfaces:
Iterator
public class MultipleIterator extends Object implements Iterator
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: 1.7 $
-
Constructor Summary
Constructors Constructor Description MultipleIterator(Iterator itr)Constructs a newUniqueMultipleIteratorinstance.MultipleIterator(Iterator[] iters)Constructs a newUniqueMultipleIteratorinstance.MultipleIterator(Iterator itr1, Iterator itr2)Constructs a newUniqueMultipleIteratorinstance.MultipleIterator(Iterator itr1, Iterator itr2, Iterator itr3)Constructs a newUniqueMultipleIteratorinstance. -
Method Summary
Modifier and Type Method Description booleanhasNext()Returnstrueif the iteration has not yet passed each of the iterators,falseotherwise.Objectnext()Returns the next element of the iteration.voidremove()The methodremove()of the interfacejava.util.Iteratorwill not be supported in this implementation.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
MultipleIterator
Constructs a newUniqueMultipleIteratorinstance.- Parameters:
iters- the iterators over which to iterate.
-
MultipleIterator
Constructs a newUniqueMultipleIteratorinstance.- Parameters:
itr- the iterator over which to iterate.
-
MultipleIterator
Constructs a newUniqueMultipleIteratorinstance.- Parameters:
itr1- the first iterator over which to iterate.itr2- the second iterator over which to iterate.
-
MultipleIterator
Constructs a newUniqueMultipleIteratorinstance.- 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 Details
-
hasNext
public boolean hasNext()Returnstrueif the iteration has not yet passed each of the iterators,falseotherwise. -
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. -
remove
The methodremove()of the interfacejava.util.Iteratorwill not be supported in this implementation.- Specified by:
removein interfaceIterator- Throws:
UnsupportedOperationException- if the method is called.
-