org.apache.lucene.util

## Class FilterIterator<T,InnerT extends T>

- java.lang.Object
- - org.apache.lucene.util.FilterIterator<T,InnerT>

- Type Parameters:
    `T` - generic parameter for this iterator instance: this iterator implements `Iterator<T>`
    `InnerT` - generic parameter of the wrapped iterator, must be `T` or extend `T`
  All Implemented Interfaces:
    Iterator<T>

      public abstract class FilterIterator<T,InnerT extends T>
      extends Object
      implements Iterator<T>

  An `Iterator` implementation that filters elements with a boolean predicate.
  See Also:
    `predicateFunction(InnerT)`
  NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FilterIterator(Iterator<InnerT> baseIterator)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `hasNext()`
    `T` | `next()`
    `protected abstract boolean` | `predicateFunction(InnerT object)` returns true, if this element should be returned by `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

          public FilterIterator(Iterator<InnerT> baseIterator)

  - ### Method Detail

    - #### predicateFunction

          protected abstract boolean predicateFunction(InnerT object)

      returns true, if this element should be returned by `next()`.

    - #### hasNext

          public final boolean hasNext()

      Specified by:
        `hasNext` in interface `Iterator<T>`

    - #### next

          public final T next()

      Specified by:
        `next` in interface `Iterator<T>`

    - #### remove

          public final void remove()

      Specified by:
        `remove` in interface `Iterator<T>`

Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.