Class Iterators.MultipleLookaheadIterator<T>

java.lang.Object
eu.bandm.tools.util.java.Iterators.MultipleLookaheadIterator<T>
All Implemented Interfaces:
Iterator<T>
Enclosing class:
Iterators

public static class Iterators.MultipleLookaheadIterator<T> extends Object implements Iterator<T>
An iterator which allows arbitrary deep look-ahead for an underlying iterator.
  • Constructor Details

    • MultipleLookaheadIterator

      public MultipleLookaheadIterator(Iterable<? extends T> things)
      Constructor which sets the underlying iterator.
    • MultipleLookaheadIterator

      @SafeVarargs public MultipleLookaheadIterator(T... things)
      Constructor which iterates over the given things.
    • MultipleLookaheadIterator

      public MultipleLookaheadIterator(Iterator<? extends T> it)
  • 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()
      Unsupported Operation
      Specified by:
      remove in interface Iterator<T>
    • hasNext

      public boolean hasNext(int index)
      Returns whether the next (index+1) calls to hasNext() will be successful.
    • lookahead

      public T lookahead(int index)
      Returns the object delivered by the last of (index+1) calls of next(), as defined with the original iterator.