Class PeekIterator<T>

  • All Implemented Interfaces:
    java.util.Iterator<T>

    public class PeekIterator<T>
    extends java.lang.Object
    implements java.util.Iterator<T>
    PeekIterator - is one slot ahead from the wrapped iterator
    • Constructor Summary

      Constructors 
      Constructor Description
      PeekIterator​(java.util.Iterator<T> iter)  
    • Constructor Detail

      • PeekIterator

        public PeekIterator​(java.util.Iterator<T> iter)
    • Method Detail

      • create

        public static <T> PeekIterator<T> create​(java.util.Iterator<T> iter)
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<T>
      • peek

        public T peek()
        Peek the next element or return null
        See Also:
        Queue.peek()
      • element

        public T element()
        Peek the next element or throw NoSuchElementException
      • next

        public T next()
        Specified by:
        next in interface java.util.Iterator<T>