Class IteratorModule.ConcatIterator<T>

    • Constructor Detail

      • ConcatIterator

        public ConcatIterator()
    • Method Detail

      • append

        void append​(java.util.Iterator<? extends T> that)
      • concat

        public Iterator<T> concat​(java.util.Iterator<? extends T> that)
        Description copied from interface: Iterator
        Returns a new Iterator that yields the elements of this iterator followed by all elements of the specified iterator.

        This method appends the elements from that to the end of this iterator, creating a concatenated sequence.

        Examples:

         Iterator.of(1, 2).concat(Iterator.of(3, 4))  // yields 1, 2, 3, 4
         Iterator.empty().concat(Iterator.of(1, 2))   // yields 1, 2
         Iterator.of(1, 2).concat(Iterator.empty())   // yields 1, 2
         
        Parameters:
        that - the iterator whose elements should be appended
        Returns:
        a new iterator containing elements from both iterators
      • hasNext

        public boolean hasNext()