Package generic.util

# Class WrappingPeekableIterator<T>

java.lang.Object
generic.util.AbstractPeekableIterator<T>
generic.util.WrappingPeekableIterator<T>

Type Parameters:
  `T` - the type of the iterator

All Implemented Interfaces:
  `PeekableIterator<T>`, `Iterator<T>`

public class WrappingPeekableIterator<T> extends AbstractPeekableIterator<T>
An implementation of `PeekableIterator` that can take a Java `Iterator` and wrap it to implement the `PeekableIterator` interface.

- ## Field Summary

  ### Fields inherited from class generic.util.AbstractPeekableIterator

  `next, soughtNext`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WrappingPeekableIterator(Iterator<T> iterator)`
  Wrap the given iterator

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `remove()`
  `protected T`
  `seekNext()`
  Find the next element in this iterator, because the client called either `AbstractPeekableIterator.next` or `AbstractPeekableIterator.peek()`.

  ### Methods inherited from class generic.util.AbstractPeekableIterator

  `hasNext, next, peek`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface java.util.Iterator

  `forEachRemaining`

- ## Constructor Details

  - ### WrappingPeekableIterator

    public WrappingPeekableIterator(Iterator<T> iterator)
    Wrap the given iterator
    Parameters:
      `iterator` - the iterator
    See Also:
      - `PeekableIterators.castOrWrap(Iterator)`

- ## Method Details

  - ### remove

    public void remove()

  - ### seekNext

    protected T seekNext()
    Description copied from class: `AbstractPeekableIterator`
    Find the next element in this iterator, because the client called either `AbstractPeekableIterator.next` or `AbstractPeekableIterator.peek()`.
    Specified by:
      `seekNext` in class `AbstractPeekableIterator<T>`
    Returns:
      the next element