|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.common.collect.UnmodifiableIterator<T> com.google.common.collect.AbstractLinkedIterator<T>
AbstractSequentialIterator
.
This class is scheduled to be removed in Guava release 13.0.
@Beta @Deprecated @GwtCompatible public abstract class AbstractLinkedIterator<T>
This class provides a skeletal implementation of the Iterator
interface for sequences whose next element can always be derived from the
previous element. Null elements are not supported, nor is the
UnmodifiableIterator.remove()
method.
Example:
Iterator<Integer> powersOfTwo = new AbstractLinkedIterator<Integer>(1) {
protected Integer computeNext(Integer previous) {
return (previous == 1 << 30) ? null : previous * 2;
}
};
Constructor Summary | |
---|---|
protected |
AbstractLinkedIterator(T firstOrNull)
Deprecated. Creates a new iterator with the given first element, or, if firstOrNull is null, creates a new empty iterator. |
Method Summary | |
---|---|
protected abstract T |
computeNext(T previous)
Deprecated. Returns the element that follows previous , or returns null
if no elements remain. |
boolean |
hasNext()
Deprecated. |
T |
next()
Deprecated. |
Methods inherited from class com.google.common.collect.UnmodifiableIterator |
---|
remove |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractLinkedIterator(@Nullable T firstOrNull)
firstOrNull
is null, creates a new empty iterator.
Method Detail |
---|
protected abstract T computeNext(T previous)
previous
, or returns null
if no elements remain. This method is invoked during each call to
next()
in order to compute the result of a future call to
next()
.
public final boolean hasNext()
public final T next()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |