|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jga.util.LookAheadIterator<T>
public class LookAheadIterator<T>
Iterator that allows the program to look at and operate on the next few elements without consuming them.
Copyright © 2003-2005 David A. Hall
Constructor Summary | |
---|---|
LookAheadIterator(java.util.Iterator<? extends T> base)
Builds a LookAheadIterator that can look ahead 1 element. |
|
LookAheadIterator(java.util.Iterator<? extends T> base,
int max)
Builds a LookAheadIterator that can look ahead the given number of elements. |
Method Summary | |
---|---|
int |
getMaxPeekSize()
Returns the maximum offset that may be peeked. |
boolean |
hasNext()
|
boolean |
hasNextPlus(int n)
Returns true if there is an element at the Nth position. |
java.util.Iterator<T> |
iterator()
|
T |
next()
|
T |
peek(int n)
Returns the element at the Nth position. |
void |
remove()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LookAheadIterator(java.util.Iterator<? extends T> base)
public LookAheadIterator(java.util.Iterator<? extends T> base, int max)
java.lang.IllegalArgumentException
- if max <= 0.Method Detail |
---|
public boolean hasNextPlus(int n)
java.lang.IllegalArgumentException
- if n < 0 or n > max lookaheadpublic T peek(int n)
java.lang.IllegalArgumentException
- if n < 0 or n > max lookahead
java.util.NoSuchElementException
- if the Nth position is off the end of
the iterationpublic int getMaxPeekSize()
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
public boolean hasNext()
hasNext
in interface java.util.Iterator<T>
public T next()
next
in interface java.util.Iterator<T>
public void remove()
remove
in interface java.util.Iterator<T>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |