Class IteratorCons<T>

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

    public class IteratorCons<T>
    extends java.lang.Object
    implements java.util.Iterator<T>, java.lang.Iterable<T>
    IteratorCons : the concatenation of two iterators. See also IteratorConcat. If there potentially many iterators to be joined, it is better to create an IteratorConcat explicitly and add each iterator. IteratorCons is slightly better in the two iterator case.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <X> java.util.Iterator<X> create​(java.util.Iterator<? extends X> iter1, java.util.Iterator<? extends X> iter2)  
      boolean hasNext()  
      java.util.Iterator<T> iterator()  
      T next()  
      void remove()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Method Detail

      • create

        public static <X> java.util.Iterator<X> create​(java.util.Iterator<? extends X> iter1,
                                                       java.util.Iterator<? extends X> iter2)
      • hasNext

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

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

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T>
      • remove

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