edu.rice.cs.plt.iter
Class SkipLastIterator<T>
java.lang.Object
edu.rice.cs.plt.iter.ReadOnlyIterator<T>
edu.rice.cs.plt.iter.SkipLastIterator<T>
- All Implemented Interfaces:
- Composite, java.util.Iterator<T>
public class SkipLastIterator<T>
- extends ReadOnlyIterator<T>
- implements Composite
An iterator that skips the last element of a nested iterator.
Since it must read ahead to check if the current element is the last,
remove is not supported.
|
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
|
make(java.util.Iterator<? extends T> i)
Call the constructor (allows T to be inferred) |
T |
next()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SkipLastIterator
public SkipLastIterator(java.util.Iterator<? extends T> i)
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 java.util.Iterator<T>
next
public T next()
- Specified by:
next in interface java.util.Iterator<T>
make
public static <T> SkipLastIterator<T> make(java.util.Iterator<? extends T> i)
- Call the constructor (allows
T to be inferred)