Package generic.util

# Class WrappingPeekableIterator<T>

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

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

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

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

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `hasNext()`
  `T`
  `next()`
  `T`
  `peek()`
  Returns the item that would be returned by calling `Iterator.next()`, but does not increment the iterator as `next` would.
  `void`
  `remove()`

  ### 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)

- ## Method Details

  - ### hasNext

    public boolean hasNext()
    Specified by:
      `hasNext` in interface `Iterator<T>`

  - ### next

    public T next()
    Specified by:
      `next` in interface `Iterator<T>`

  - ### remove

    public void remove()
    Specified by:
      `remove` in interface `Iterator<T>`

  - ### peek

    public T peek() throws NoSuchElementException
    Description copied from interface: `PeekableIterator`
    Returns the item that would be returned by calling `Iterator.next()`, but does not increment the iterator as `next` would.
    Specified by:
      `peek` in interface `PeekableIterator<T>`
    Returns:
      the item that would be returned by calling `Iterator.next()`
    Throws:
      `NoSuchElementException`