Class CombinedIterator<T>

java.lang.Object
com.saperion.common.lang.iterator.CombinedIterator<T>
Type Parameters:
T - type of objects to iterate
All Implemented Interfaces:
Iterator<T>

public final class CombinedIterator<T> extends Object implements Iterator<T>

An Iterator that combines two existing iterators.

It first iterates through all values of the first specified iterator and then through all values of the second specified iterator.

Iterator.remove() is not supported.

Author:
agz
  • Constructor Details

    • CombinedIterator

      public CombinedIterator(Iterator<? extends T> iterator1, Iterator<? extends T> iterator2)
      Creates a new CombinedIterator, that first iterates through all values of the first specified iterator and then through all values of the second specified iterator.

      The specified iterators must not be null.

      Parameters:
      iterator1 - first iterator
      iterator2 - second iterator
  • Method Details