edu.rice.cs.plt.iter
Class CollapsedIterator<T>

java.lang.Object
  extended by edu.rice.cs.plt.iter.CollapsedIterator<T>
All Implemented Interfaces:
Composite, Iterator<T>

public class CollapsedIterator<T>
extends Object
implements Iterator<T>, Composite

An iterator over an arbitrary number of iterators. Supports remove().


Constructor Summary
CollapsedIterator(Iterator<? extends Iterator<? extends T>> iters)
          The result traverses i1, then i2
 
Method Summary
 int compositeHeight()
          Get the maximum path length from this node to a leaf.
 int compositeSize()
          Get the number of nodes in the tree rooted at this node.
 boolean hasNext()
           
static
<T> CollapsedIterator<T>
make(Iterator<? extends Iterator<? extends T>> iters)
          Call the constructor (allows T to be inferred)
 T next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollapsedIterator

public CollapsedIterator(Iterator<? extends Iterator<? extends T>> iters)
The result traverses i1, then i2

Method Detail

compositeHeight

public int compositeHeight()
Description copied from interface: Composite
Get the maximum path length from this node to a leaf.

Specified by:
compositeHeight in interface Composite

compositeSize

public int compositeSize()
Description copied from interface: Composite
Get the number of nodes in the tree rooted at this node. Always 1 or greater.

Specified by:
compositeSize in interface Composite

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<T>

next

public T next()
Specified by:
next in interface Iterator<T>

remove

public void remove()
Specified by:
remove in interface Iterator<T>

make

public static <T> CollapsedIterator<T> make(Iterator<? extends Iterator<? extends T>> iters)
Call the constructor (allows T to be inferred)