org.eclipse.rdf4j.common.iterator

## Class UnionIterator<E>

- java.lang.Object
- - org.eclipse.rdf4j.common.iterator.AbstractCloseableIterator<E>
  - - org.eclipse.rdf4j.common.iterator.LookAheadIterator<E>
    - - org.eclipse.rdf4j.common.iterator.UnionIterator<E>

- All Implemented Interfaces:
    Closeable, AutoCloseable, Iterator<E>

      public class UnionIterator<E>
      extends LookAheadIterator<E>

  Author:
    MJAHale

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `UnionIterator(Iterable<? extends E>... args)` Creates a new UnionIterator that returns the bag union of the results of a number of Iterators.
    `UnionIterator(Iterable<? extends Iterable<? extends E>> args)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected E` | `getNextElement()` Gets the next element.
    `protected void` | `handleClose()` Called by `AbstractCloseableIterator.close()` when it is called for the first time.

    - ### Methods inherited from class org.eclipse.rdf4j.common.iterator.LookAheadIterator

      `handleAlreadyClosed, hasNext, next, remove`

    - ### Methods inherited from class org.eclipse.rdf4j.common.iterator.AbstractCloseableIterator

      `close, isClosed`

    - ### 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

    - #### UnionIterator

          public UnionIterator(Iterable<? extends E>... args)

      Creates a new UnionIterator that returns the bag union of the results of a number of Iterators.
      Parameters:
        `args` - The Iterators containing the elements to iterate over.

    - #### UnionIterator

          public UnionIterator(Iterable<? extends Iterable<? extends E>> args)

  - ### Method Detail

    - #### getNextElement

          protected E getNextElement()

      Description copied from class: `LookAheadIterator`
      Gets the next element. Subclasses should implement this method so that it returns the next element.
      Specified by:
        `getNextElement` in class `LookAheadIterator<E>`
      Returns:
        The next element, or `null` if no more elements are available.

    - #### handleClose

          protected void handleClose()
                              throws IOException

      Description copied from class: `AbstractCloseableIterator`
      Called by `AbstractCloseableIterator.close()` when it is called for the first time. This method is only called once on each iteration. By default, this method does nothing.
      Overrides:
        `handleClose` in class `LookAheadIterator<E>`
      Throws:
        `IOException`

Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.