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 Details

    • MultipleIterator

      public MultipleIterator​(Iterator[] iters)
      Constructs a new UniqueMultipleIterator instance.
      Parameters:
      iters - the iterators over which to iterate.
    • MultipleIterator

      public MultipleIterator​(Iterator itr)
      Constructs a new UniqueMultipleIterator instance.
      Parameters:
      itr - the iterator over which to iterate.
    • MultipleIterator

      public MultipleIterator​(Iterator itr1, Iterator 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 itr1, Iterator itr2, Iterator 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 Details

    • 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
      Returns:
      true if the iteration has not yet passed each of the iterators, false otherwise.
    • next

      public Object 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
      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
      Throws:
      UnsupportedOperationException - if the method is called.