Package 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
Description
`FilterIterator(Iterator<InnerT> baseIterator)`

## Method Summary

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

### FilterIterator

public FilterIterator(Iterator<InnerT> baseIterator)

## Method Details

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