Class Iterators.PeekingImpl<A>

java.lang.Object
io.atlassian.fugue.Iterators.PeekingImpl<A>
All Implemented Interfaces:
Iterators.Peek<A>, Iterators.Peeking<A>, Iterator<A>
Enclosing class:
Iterators

private static class Iterators.PeekingImpl<A> extends Object implements Iterators.Peeking<A>
Implementation of Iterators.Peeking that avoids peeking unless necessary.
Since:
3.0
  • Field Details

    • iterator

      private final Iterator<? extends A> iterator
    • hasPeeked

      private boolean hasPeeked
    • peekedElement

      private A peekedElement
  • Constructor Details

    • PeekingImpl

      public PeekingImpl(Iterator<? extends A> iterator)
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<A>
    • next

      public A next()
      Specified by:
      next in interface Iterator<A>
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<A>
    • peek

      public A peek()
      Description copied from interface: Iterators.Peek
      Look at but do not modify the "next" thing.
      Specified by:
      peek in interface Iterators.Peek<A>