Package com.singularsys.jep.configurableparser

# Class Lookahead2Iterator<E>

java.lang.Object
com.singularsys.jep.configurableparser.Lookahead2Iterator<E>

Type Parameters:
  `E` - the type of tokens

Direct Known Subclasses:
  `LookaheadNIterator`

public class Lookahead2Iterator<E> extends Object
An iterator which stores the next two tokens.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Lookahead2Iterator()`
  Default constructor.
  `Lookahead2Iterator(Iterator<E> input)`
  Decorator constructor around an iterator
  `Lookahead2Iterator(List<E> input)`
  Constructor when the list of tokens is known beforehand.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `consume()`
  Eat one token.
  `E`
  `nextnext()`
  `E`
  `peekNext()`
  `E`
  `prev()`
  Return the token just consumed.
  `void`
  `setInputIterator(Iterator<E> input)`
  Should be called if the default constructor is used.
  `String`
  `toString()`

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

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

- ## Constructor Details

  - ### Lookahead2Iterator

    public Lookahead2Iterator()
    Default constructor. If this constructor is used then the `setInputIterator(Iterator)` method should be called.
    Since:
      3.5

  - ### Lookahead2Iterator

    public Lookahead2Iterator(List<E> input)
    Constructor when the list of tokens is known beforehand.
    Parameters:
      `input` - the list of tokens

  - ### Lookahead2Iterator

    public Lookahead2Iterator(Iterator<E> input)
    Decorator constructor around an iterator
    Parameters:
      `input` - the input iterator

- ## Method Details

  - ### setInputIterator

    public void setInputIterator(Iterator<E> input)
    Should be called if the default constructor is used.
    Parameters:
      `input` - the new input iterator
    Since:
      3.5

  - ### peekNext

    public E peekNext()

  - ### nextnext

    public E nextnext()

  - ### prev

    public E prev()
    Return the token just consumed.
    Returns:
      the token, or null if no token consumed.
    Since:
      Jep 3.5

  - ### consume

    public void consume()
    Eat one token.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`