org.jboss.util.collection
Class CompoundIterator

java.lang.Object
  extended byorg.jboss.util.collection.CompoundIterator
All Implemented Interfaces:
java.util.Iterator

public class CompoundIterator
extends java.lang.Object
implements java.util.Iterator

A compound iterator, which iterates over all of the elements in the given iterators.


Field Summary
protected  int index
          The index of the current iterator.
protected  java.util.Iterator[] iters
          The array of iterators to iterate over.
 
Constructor Summary
CompoundIterator(java.util.Iterator[] iters)
          Construct a CompoundIterator over the given array of iterators.
 
Method Summary
 boolean hasNext()
          Check if there are more elements.
 java.lang.Object next()
          Return the next element from the current iterator.
 void remove()
          Remove the current element from the current iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iters

protected final java.util.Iterator[] iters
The array of iterators to iterate over.


index

protected int index
The index of the current iterator.

Constructor Detail

CompoundIterator

public CompoundIterator(java.util.Iterator[] iters)
Construct a CompoundIterator over the given array of iterators.

Parameters:
iters - Array of iterators to iterate over.
Throws:
java.lang.IllegalArgumentException - Array is null or empty.
Method Detail

hasNext

public boolean hasNext()
Check if there are more elements.

Specified by:
hasNext in interface java.util.Iterator
Returns:
True if there are more elements.

next

public java.lang.Object next()
Return the next element from the current iterator.

Specified by:
next in interface java.util.Iterator
Returns:
The next element from the current iterator.
Throws:
java.util.NoSuchElementException - There are no more elements.

remove

public void remove()
Remove the current element from the current iterator.

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.IllegalStateException
java.lang.UnsupportedOperationException