Interface PeekingIterator<E>

All Superinterfaces:
Iterator<E>

@GwtCompatible @Deprecated(since="2022-12-01") public interface PeekingIterator<E> extends Iterator<E>
Deprecated.
The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023
An iterator that supports a one-element lookahead while iterating.

See the Guava User Guide article on PeekingIterator.

Since:
2.0 (imported from Google Collections Library)
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated.
    Deprecated.
    Returns the next element in the iteration, without advancing the iteration.
    void
    Deprecated.

    Methods inherited from interface java.util.Iterator

    forEachRemaining, hasNext
  • Method Details

    • peek

      E peek()
      Deprecated.
      Returns the next element in the iteration, without advancing the iteration.

      Calls to peek() should not change the state of the iteration, except that it may prevent removal of the most recent element via remove().

      Throws:
      NoSuchElementException - if the iteration has no more elements according to Iterator.hasNext()
    • next

      E next()
      Deprecated.

      The objects returned by consecutive calls to peek() then next() are guaranteed to be equal to each other.

      Specified by:
      next in interface Iterator<E>
    • remove

      void remove()
      Deprecated.

      Implementations may or may not support removal when a call to peek() has occurred since the most recent call to next().

      Specified by:
      remove in interface Iterator<E>
      Throws:
      IllegalStateException - if there has been a call to peek() since the most recent call to next() and this implementation does not support this sequence of calls (optional)