org.eclipse.rdf4j.common.iteration

## Class ConvertingIteration<S,T,X extends Exception>

- java.lang.Object
- - org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration<T,X>
  - - org.eclipse.rdf4j.common.iteration.ConvertingIteration<S,T,X>

- All Implemented Interfaces:
    AutoCloseable, CloseableIteration<T,X>, Iteration<T,X>
  Direct Known Subclasses:
    BoundJoinConversionIteration, BoundJoinVALUESConversionIteration, ExtensionIterator, GroupedCheckConversionIteration, InsertBindingsIteration, ProjectionIterator, ServiceJoinConversionIteration

      public abstract class ConvertingIteration<S,T,X extends Exception>
      extends AbstractCloseableIteration<T,X>

  A CloseableIteration that converts an iteration over objects of type `S` (the source type) to an iteration over objects of type `T` (the target type).

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ConvertingIteration(Iteration<? extends S,? extends X> iter)` Creates a new ConvertingIteration that operates on the supplied source type iteration.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract T` | `convert(S sourceObject)` Converts a source type object to a target type object.
    `protected void` | `handleClose()` Closes this iteration as well as the wrapped iteration if it is a `CloseableIteration`.
    `boolean` | `hasNext()` Checks whether the source type iteration contains more elements.
    `T` | `next()` Returns the next element from the source type iteration.
    `void` | `remove()` Calls `remove()` on the underlying Iteration.

    - ### Methods inherited from class org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration

      `close, isClosed`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.common.iteration.Iteration

      `stream`

- - ### Constructor Detail

    - #### ConvertingIteration

          protected ConvertingIteration(Iteration<? extends S,? extends X> iter)

      Creates a new ConvertingIteration that operates on the supplied source type iteration.
      Parameters:
        `iter` - The source type iteration for this `ConvertingIteration`, must not be `null`.

  - ### Method Detail

    - #### convert

          protected abstract T convert(S sourceObject)
                                throws X extends Exception

      Converts a source type object to a target type object.
      Throws:
        `X extends Exception`

    - #### hasNext

          public boolean hasNext()
                          throws X extends Exception

      Checks whether the source type iteration contains more elements.
      Returns:
        `true` if the source type iteration contains more elements, `false` otherwise.
      Throws:
        `X`
        `X extends Exception`

    - #### next

          public T next()
                 throws X extends Exception

      Returns the next element from the source type iteration.
      Returns:
        the next element in the iteration.
      Throws:
        `X`
        `NoSuchElementException` - If all elements have been returned.
        `IllegalStateException` - If the iteration has been closed.
        `X extends Exception`

    - #### remove

          public void remove()
                      throws X extends Exception

      Calls `remove()` on the underlying Iteration.
      Throws:
        `UnsupportedOperationException` - If the wrapped Iteration does not support the `remove` operation.
        `IllegalStateException` - If the Iteration has been closed, or if `next()` has not yet been called, or `remove()` has already been called after the last call to `next()`.
        `X extends Exception`

    - #### handleClose

          protected void handleClose()
                              throws X extends Exception

      Closes this iteration as well as the wrapped iteration if it is a `CloseableIteration`.
      Overrides:
        `handleClose` in class `AbstractCloseableIteration<T,X extends Exception>`
      Throws:
        `X`
        `X extends Exception`

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