org.springframework.util

## Class CompositeIterator<E>

- java.lang.Object
- - org.springframework.util.CompositeIterator<E>

- Type Parameters:
    `E` - the element type
  All Implemented Interfaces:
    Iterator<E>

      public class CompositeIterator<E>
      extends Object
      implements Iterator<E>

  Composite iterator that combines multiple other iterators, as registered via `add(Iterator)`.

  This implementation maintains a linked set of iterators which are invoked in sequence until all iterators are exhausted.

  Since:
    3.0
  Author:
    Erwin Vervaet, Juergen Hoeller

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompositeIterator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(Iterator<E> iterator)` Add given iterator to this composite.
    `boolean` | `hasNext()`
    `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

      `forEachRemaining`

- - ### Constructor Detail

    - #### CompositeIterator

          public CompositeIterator()

  - ### Method Detail

    - #### add

          public void add(Iterator<E> iterator)

      Add given iterator to this composite.

    - #### hasNext

          public boolean hasNext()

      Specified by:
        `hasNext` in interface `Iterator<E>`

    - #### next

          public E next()

      Specified by:
        `next` in interface `Iterator<E>`

    - #### remove

          public void remove()

      Specified by:
        `remove` in interface `Iterator<E>`