org.eclipse.rdf4j.util.iterators

## Class FilterIterator<E>

- java.lang.Object
- - org.eclipse.rdf4j.util.iterators.FilterIterator<E>

- All Implemented Interfaces:
    Iterator<E>

      public abstract class FilterIterator<E>
      extends Object
      implements Iterator<E>

  A CloseableIterator that wraps another iterator, applying a filter on the objects that are returned. Subclasses must implement the `accept` method to indicate which objects should be returned.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `FilterIterator(Iterator<? extends E> iter)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract boolean` | `accept(E object)` Tests whether or not the specified object should be returned by this iterator.
    `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

    - #### FilterIterator

          protected FilterIterator(Iterator<? extends E> iter)

  - ### Method Detail

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

    - #### accept

          protected abstract boolean accept(E object)

      Tests whether or not the specified object should be returned by this iterator. All objects from the wrapped iterator pass through this method in the same order as they are coming from the wrapped iterator.
      Parameters:
        `object` - The object to be tested.
      Returns:
        `true` if the object should be returned, `false` otherwise.
      Throws:
        `X`

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