Class AbstractSequentialIterator<T>
java.lang.Object
com.google.common.collect.UnmodifiableIterator<T>
com.google.common.collect.AbstractSequentialIterator<T>
- All Implemented Interfaces:
- Iterator<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 AbstractSequentialIterator<Integer>(1) {
      protected Integer computeNext(Integer previous) {
        return (previous == 1 << 30) ? null : previous * 2;
      }
    };
- Since:
- 12.0 (in Guava as AbstractLinkedIteratorsince 8.0)
- Author:
- Chris Povirk
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractSequentialIterator(@Nullable T firstOrNull) Creates a new iterator with the given first element, or, iffirstOrNullis null, creates a new empty iterator.
- 
Method SummaryMethods inherited from class com.google.common.collect.UnmodifiableIteratorremoveMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.IteratorforEachRemaining
- 
Constructor Details- 
AbstractSequentialIterator
 
- 
- 
Method Details- 
computeNext
- 
hasNextpublic final boolean hasNext()
- 
next
 
-