Package com.google.common.collect
Class AbstractSequentialIterator<T>
- java.lang.Object
 - 
- com.google.common.collect.UnmodifiableIterator<T>
 - 
- com.google.common.collect.AbstractSequentialIterator<T>
 
 
 
- 
- All Implemented Interfaces:
 java.util.Iterator<T>
@GwtCompatible public abstract class AbstractSequentialIterator<T> extends UnmodifiableIterator<T>
This class provides a skeletal implementation of theIteratorinterface for sequences whose next element can always be derived from the previous element. Null elements are not supported, nor is theUnmodifiableIterator.remove()method.Example:
Iterator<Integer> powersOfTwo = new AbstractSequentialIterator<Integer>(1) { protected Integer computeNext(Integer previous) { return (previous == 1 << 30) ? null : previous * 2; } };- Since:
 - 12.0 (in Guava as 
AbstractLinkedIteratorsince 8.0) 
 
- 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasNext()Tnext()- 
Methods inherited from class com.google.common.collect.UnmodifiableIterator
remove 
 - 
 
 - 
 
- 
- 
Method Detail
- 
hasNext
public final boolean hasNext()
 
- 
next
public final T next()
 
 - 
 
 -