Package org.apache.ignite.internal.processors.cache.persistence.wal.reader

## Class FilteredWalIterator

- java.lang.Object
- - org.apache.ignite.internal.util.lang.GridIteratorAdapter<IgniteBiTuple<WALPointer,​WALRecord>>
  - - org.apache.ignite.internal.processors.cache.persistence.wal.reader.FilteredWalIterator

All Implemented Interfaces:
  `Serializable`, `AutoCloseable`, `Iterable<IgniteBiTuple<WALPointer,​WALRecord>>`, `Iterator<IgniteBiTuple<WALPointer,​WALRecord>>`, `WALIterator`, `GridSerializableIterator<IgniteBiTuple<WALPointer,​WALRecord>>`, `GridCloseableIterator<IgniteBiTuple<WALPointer,​WALRecord>>`, `GridIterator<IgniteBiTuple<WALPointer,​WALRecord>>`, `IgniteSpiCloseableIterator<IgniteBiTuple<WALPointer,​WALRecord>>`

    public class FilteredWalIterator
    extends GridIteratorAdapter<IgniteBiTuple<WALPointer,​WALRecord>>
    implements WALIterator

Decorator of `WALIterator` which allow filter record by `WALPointer` and `WALRecord`.

See Also:
  Serialized Form

### Constructor Summary

Constructors
`FilteredWalIterator​(WALIterator walIterator, Predicate<IgniteBiTuple<WALPointer,​WALRecord>> filter)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Closes the iterator and frees all the resources held by the iterator.
`boolean` `hasNextX()` This method is the same as `Iterator.hasNext()`, but allows for failure with exception.
`boolean` `isClosed()` Checks if iterator has been closed.
`Optional<WALPointer>` `lastRead()`
`IgniteBiTuple<WALPointer,​WALRecord>` `nextX()` This method is the same as `Iterator.next()`, but allows for failure with exception.
`void` `removeX()` This method is the same as `Iterator.remove()`, but allows for failure with exception.

### Methods inherited from class org.apache.ignite.internal.util.lang.GridIteratorAdapter

`hasNext, iterator, next, remove`

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

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

### Methods inherited from interface java.lang.Iterable

`forEach, iterator, spliterator`

### Methods inherited from interface java.util.Iterator

`forEachRemaining, hasNext, next, remove`

### Constructor Detail

#### FilteredWalIterator

    public FilteredWalIterator​(WALIterator walIterator,
                               Predicate<IgniteBiTuple<WALPointer,​WALRecord>> filter)
                        throws IgniteCheckedException

Parameters:
  `walIterator` - Source WAL iterator which provide data for filtering.
  `filter` - Filter for filtering iterated data.
Throws:
  `IgniteCheckedException`

### Method Detail

#### lastRead

    public Optional<WALPointer> lastRead()

Specified by:
  `lastRead` in interface `WALIterator`
Returns:
  Pointer to the last record returned by the `Iterator.next()` method. If records are filtered by the `IgniteWalIteratorFactory.IteratorParametersBuilder.filter(IgniteBiPredicate)` then pointer to the last valid record returned.

#### nextX

    public IgniteBiTuple<WALPointer,​WALRecord> nextX()
                                                    throws IgniteCheckedException

This method is the same as `Iterator.next()`, but allows for failure with exception. Often iterators are used to iterate through values that have not or have partially been received from remote nodes, and need to account for possible network failures, rather than throwing `NoSuchElementException` runtime exception.s

Specified by:
  `nextX` in interface `GridIterator<IgniteBiTuple<WALPointer,​WALRecord>>`
Returns:
  `True` if iterator contains more elements.
Throws:
  `IgniteCheckedException` - If no more elements can be returned due to some failure, like a network error for example.
See Also:
  `Iterator.next()`

#### hasNextX

    public boolean hasNextX()
                     throws IgniteCheckedException

This method is the same as `Iterator.hasNext()`, but allows for failure with exception. Often iterators are used to iterate through values that have not or have partially been received from remote nodes, and need to account for possible network failures, rather than just returning `false` out of `Iterator.hasNext()` method.

Specified by:
  `hasNextX` in interface `GridIterator<IgniteBiTuple<WALPointer,​WALRecord>>`
Returns:
  `True` if iterator contains more elements.
Throws:
  `IgniteCheckedException` - If no more elements can be returned due to some failure, like a network error for example.
See Also:
  `Iterator.hasNext()`

#### removeX

    public void removeX()
                 throws IgniteCheckedException

This method is the same as `Iterator.remove()`, but allows for failure with exception.

Specified by:
  `removeX` in interface `GridIterator<IgniteBiTuple<WALPointer,​WALRecord>>`
Throws:
  `IgniteCheckedException` - If failed.

#### close

    public void close()
               throws IgniteCheckedException

Closes the iterator and frees all the resources held by the iterator. Iterator can not be used any more after calling this method.

The method is invoked automatically on objects managed by the `try-with-resources` statement.

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `GridCloseableIterator<IgniteBiTuple<WALPointer,​WALRecord>>`
Specified by:
  `close` in interface `IgniteSpiCloseableIterator<IgniteBiTuple<WALPointer,​WALRecord>>`
Throws:
  `IgniteCheckedException` - In case of error.

#### isClosed

    public boolean isClosed()

Checks if iterator has been closed.

Specified by:
  `isClosed` in interface `GridCloseableIterator<IgniteBiTuple<WALPointer,​WALRecord>>`
Returns:
  `True` if iterator has been closed.