org.eclipse.rdf4j.common.iteration

## Class DistinctIteration<E,X extends Exception>

- java.lang.Object
- - org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration<E,X>
  - - org.eclipse.rdf4j.common.iteration.IterationWrapper<E,X>
    - - org.eclipse.rdf4j.common.iteration.FilterIteration<E,X>
      - - org.eclipse.rdf4j.common.iteration.DistinctIteration<E,X>

- All Implemented Interfaces:
    AutoCloseable, CloseableIteration<E,X>, Iteration<E,X>
  Direct Known Subclasses:
    LimitedSizeDistinctIteration

      public class DistinctIteration<E,X extends Exception>
      extends FilterIteration<E,X>

  An Iteration that filters any duplicate elements from an underlying iterator.

- - ### Field Summary

    - ### Fields inherited from class org.eclipse.rdf4j.common.iteration.IterationWrapper

      `wrappedIter`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DistinctIteration(Iteration<? extends E,? extends X> iter)` Creates a new DistinctIterator.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `accept(E object)` Returns `true` if the specified object hasn't been seen before.
    `protected boolean` | `add(E object)`
    `protected Set<E>` | `makeSet()`

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

      `handleClose, hasNext, next`

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

      `remove`

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

    - #### DistinctIteration

          public DistinctIteration(Iteration<? extends E,? extends X> iter)

      Creates a new DistinctIterator.
      Parameters:
        `iter` - The underlying iterator.

  - ### Method Detail

    - #### accept

          protected boolean accept(E object)
                            throws X extends Exception

      Returns `true` if the specified object hasn't been seen before.
      Specified by:
        `accept` in class `FilterIteration<E,X extends Exception>`
      Parameters:
        `object` - The object to be tested.
      Returns:
        `true` if the object should be returned, `false` otherwise.
      Throws:
        `X`
        `X extends Exception`

    - #### add

          protected boolean add(E object)
                         throws X extends Exception

      Parameters:
        `object` - to put into the set
      Throws:
        `X extends Exception`

    - #### makeSet

          protected Set<E> makeSet()

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