Class Pair.FirstAndIterator<E>

  • Type Parameters:
    E - Element type
    All Implemented Interfaces:
    Enclosing class:

    private static class Pair.FirstAndIterator<E>
    extends java.lang.Object
    implements java.util.Iterator<Pair<E,​E>>
    Iterator that returns the first element of a collection paired with every other element.
    • Field Summary

      Modifier and Type Field Description
      private E first  
      private java.util.Iterator<E> iterator  
    • Constructor Summary

      Constructor Description
      FirstAndIterator​(java.util.Iterator<E> iterator, E first)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()  
      Pair<E,​E> next()  
      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

    • Field Detail

      • iterator

        private final java.util.Iterator<E> iterator
      • first

        private final E first
    • Constructor Detail

      • FirstAndIterator

        FirstAndIterator​(java.util.Iterator<E> iterator,
                         E first)
    • Method Detail

      • hasNext

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

        public Pair<E,​E> next()
        Specified by:
        next in interface java.util.Iterator<E>
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<E>