aboutsummaryrefslogtreecommitdiff
path: root/guava/src/com/google/common/collect/AbstractSequentialIterator.java
diff options
context:
space:
mode:
Diffstat (limited to 'guava/src/com/google/common/collect/AbstractSequentialIterator.java')
-rw-r--r--guava/src/com/google/common/collect/AbstractSequentialIterator.java44
1 files changed, 23 insertions, 21 deletions
diff --git a/guava/src/com/google/common/collect/AbstractSequentialIterator.java b/guava/src/com/google/common/collect/AbstractSequentialIterator.java
index 8ef569f1c..c6567f58e 100644
--- a/guava/src/com/google/common/collect/AbstractSequentialIterator.java
+++ b/guava/src/com/google/common/collect/AbstractSequentialIterator.java
@@ -17,46 +17,48 @@
package com.google.common.collect;
import com.google.common.annotations.GwtCompatible;
+
import java.util.NoSuchElementException;
-import org.checkerframework.checker.nullness.qual.Nullable;
+
+import javax.annotation.Nullable;
/**
- * This class provides a skeletal implementation of the {@code Iterator} interface for sequences
- * whose next element can always be derived from the previous element. Null elements are not
- * supported, nor is the {@link #remove()} method.
+ * This class provides a skeletal implementation of the {@code Iterator}
+ * interface for sequences whose next element can always be derived from the
+ * previous element. Null elements are not supported, nor is the
+ * {@link #remove()} method.
*
- * <p>Example:
+ * <p>Example: <pre> {@code
*
- * <pre>{@code
- * Iterator<Integer> powersOfTwo =
- * new AbstractSequentialIterator<Integer>(1) {
- * protected Integer computeNext(Integer previous) {
- * return (previous == 1 << 30) ? null : previous * 2;
- * }
- * };
- * }</pre>
+ * Iterator<Integer> powersOfTwo =
+ * new AbstractSequentialIterator<Integer>(1) {
+ * protected Integer computeNext(Integer previous) {
+ * return (previous == 1 << 30) ? null : previous * 2;
+ * }
+ * };}</pre>
*
* @author Chris Povirk
* @since 12.0 (in Guava as {@code AbstractLinkedIterator} since 8.0)
*/
@GwtCompatible
-public abstract class AbstractSequentialIterator<T> extends UnmodifiableIterator<T> {
- private @Nullable T nextOrNull;
+public abstract class AbstractSequentialIterator<T>
+ extends UnmodifiableIterator<T> {
+ private T nextOrNull;
/**
- * Creates a new iterator with the given first element, or, if {@code firstOrNull} is null,
- * creates a new empty iterator.
+ * Creates a new iterator with the given first element, or, if {@code
+ * firstOrNull} is null, creates a new empty iterator.
*/
protected AbstractSequentialIterator(@Nullable T firstOrNull) {
this.nextOrNull = firstOrNull;
}
/**
- * Returns the element that follows {@code previous}, or returns {@code null} if no elements
- * remain. This method is invoked during each call to {@link #next()} in order to compute the
- * result of a <i>future</i> call to {@code next()}.
+ * Returns the element that follows {@code previous}, or returns {@code null}
+ * if no elements remain. This method is invoked during each call to
+ * {@link #next()} in order to compute the result of a <i>future</i> call to
+ * {@code next()}.
*/
- @Nullable
protected abstract T computeNext(T previous);
@Override