Class IteratorModule.ConcatIterator<T>

java.lang.Object
io.vavr.collection.AbstractIterator<T>
io.vavr.collection.IteratorModule.ConcatIterator<T>
All Implemented Interfaces:
Foldable<T>, Iterator<T>, Traversable<T>, Value<T>, Iterable<T>, Iterator<T>
Enclosing interface:
IteratorModule

public static final class IteratorModule.ConcatIterator<T> extends AbstractIterator<T>
  • Field Details

  • Constructor Details

    • ConcatIterator

      public ConcatIterator()
  • Method Details

    • append

      void append(Iterator<? extends T> that)
    • concat

      public Iterator<T> concat(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()
    • getNext

      public T getNext()
      Specified by:
      getNext in class AbstractIterator<T>