/** * Returns the next element in the iteration without advancing the iteration, according to the * contract of {@link PeekingIterator#peek()}. * * <p>Implementations of {@code AbstractIterator} that wish to expose this functionality should * implement {@code PeekingIterator}. */ public final T peek() { if (!hasNext()) { throw new NoSuchElementException(); } return next; } }
@CanIgnoreReturnValue // TODO(kak): Should we remove this? @Override public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; T result = next; next = null; return result; }
/** * Returns the next element in the iteration without advancing the iteration, according to the * contract of {@link PeekingIterator#peek()}. * * <p>Implementations of {@code AbstractIterator} that wish to expose this functionality should * implement {@code PeekingIterator}. */ public final T peek() { if (!hasNext()) { throw new NoSuchElementException(); } return next; } }
/** * Returns the next element in the iteration without advancing the iteration, according to the * contract of {@link PeekingIterator#peek()}. * * <p>Implementations of {@code AbstractIterator} that wish to expose this functionality should * implement {@code PeekingIterator}. */ public final T peek() { if (!hasNext()) { throw new NoSuchElementException(); } return next; } }
@CanIgnoreReturnValue // TODO(kak): Should we remove this? @Override public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; T result = next; next = null; return result; }
@CanIgnoreReturnValue // TODO(kak): Should we remove this? @Override public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; T result = next; next = null; return result; }
assertTrue(iter.hasNext()); assertEquals(0, (int) iter.peek()); assertEquals(0, (int) iter.next());
public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; return next; }
public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; return next; }
public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; return next; }
@Override public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; return next; }
@Override public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; return next; }
public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; return next; }
@Override public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; T result = next; next = null; return result; }
@Override public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; return next; }
@Override public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; T result = next; next = null; return result; }
@Override public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; T result = next; next = null; return result; }
@Override public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; return next; }
@CanIgnoreReturnValue // TODO(kak): Should we remove this? @Override public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; T result = next; next = null; return result; }
@CanIgnoreReturnValue // TODO(kak): Should we remove this? @Override public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } state = State.NOT_READY; T result = next; next = null; return result; }