edu.rice.cs.plt.iter
Class ImmutableIterator<T>
java.lang.Object
edu.rice.cs.plt.iter.ReadOnlyIterator<T>
edu.rice.cs.plt.iter.ImmutableIterator<T>
- All Implemented Interfaces:
- Composite, java.util.Iterator<T>
public class ImmutableIterator<T>
- extends ReadOnlyIterator<T>
- implements Composite
Wraps an iterator in an immutable interface, preventing modifications to underlying data
structures via ReadOnlyIterator.remove().
|
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 |
ImmutableIterator
public ImmutableIterator(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> ImmutableIterator<T> make(java.util.Iterator<? extends T> i)
- Call the constructor (allows
T to be inferred)