Package org.eclipse.rdf4j.common.iteration

## Class IterationSpliterator<T>

- java.lang.Object
- - java.util.Spliterators.AbstractSpliterator<T>
  - - org.eclipse.rdf4j.common.iteration.IterationSpliterator<T>

- All Implemented Interfaces:
    `Spliterator<T>`

      public class IterationSpliterator<T>
      extends Spliterators.AbstractSpliterator<T>

  A `Spliterator` implementation that wraps an `Iteration`. It handles occurrence of checked exceptions by wrapping them in RuntimeExceptions, and in addition ensures that the wrapped Iteration is closed when exhausted (if it's a `CloseableIteration`).
  Author:
    Jeen Broekstra

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface java.util.Spliterator

      `Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T extends Object,​T_CONS extends Object,​T_SPLITR extends Spliterator.OfPrimitive<T,​T_CONS,​T_SPLITR>>`

  - ### Field Summary

    - ### Fields inherited from interface java.util.Spliterator

      `CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `IterationSpliterator​(Iteration<T,​? extends Exception> iteration)` | Creates a `Spliterator` implementation that wraps the supplied `Iteration`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `forEachRemaining​(Consumer<? super T> action)` |
    `boolean` | `tryAdvance​(Consumer<? super T> action)` |

    - ### Methods inherited from class java.util.Spliterators.AbstractSpliterator

      `characteristics, estimateSize, trySplit`

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

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

    - ### Methods inherited from interface java.util.Spliterator

      `getComparator, getExactSizeIfKnown, hasCharacteristics`

- - ### Constructor Detail

    - #### IterationSpliterator

          public IterationSpliterator​(Iteration<T,​? extends Exception> iteration)

      Creates a `Spliterator` implementation that wraps the supplied `Iteration`. It handles occurrence of checked exceptions by wrapping them in RuntimeExceptions, and in addition ensures that the wrapped Iteration is closed when exhausted (if it's a `CloseableIteration`).
      Parameters:
        `iteration` - the iteration to wrap

  - ### Method Detail

    - #### tryAdvance

          public boolean tryAdvance​(Consumer<? super T> action)

    - #### forEachRemaining

          public void forEachRemaining​(Consumer<? super T> action)