org.apache.ignite.internal.util.lang

## Interface GridIterator<T>

All Superinterfaces:
  GridSerializableIterator<T>, Iterable<T>, Iterator<T>, Serializable

All Known Subinterfaces:
  CacheWeakQueryIteratorsHolder.WeakReferenceCloseableIterator<T>, GridCloseableIterator<T>, GridIterable<T>

All Known Implementing Classes:
  CacheWeakQueryIteratorsHolder.WeakQueryCloseableIterator, GridCloseableIteratorAdapter, GridCloseableIteratorAdapterEx, GridEmptyCloseableIterator, GridEmptyIterator, GridIterableAdapter, GridIteratorAdapter, GridSpiCloseableIteratorWrapper

    public interface GridIterator<T>
    extends Iterable<T>, GridSerializableIterator<T>

Defines "rich" iterator interface that is also acts like lambda function and iterable.

See Also:
  `GridIterable`

### Method Summary

Methods
`boolean` `hasNextX()` This method is the same as `Iterator.hasNext()`, but allows for failure with exception.
`T` `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 interface java.lang.Iterable

`iterator`

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

`hasNext, next, remove`

### Method Detail

#### hasNextX

    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.

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()`

#### nextX

    T 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

Returns:
  `True` if iterator contains more elements.
Throws:
  `NoSuchElementException` - If there are no more elements to return.
  `IgniteCheckedException` - If no more elements can be returned due to some failure, like a network error for example.
See Also:
  `Iterator.next()`

#### removeX

    void removeX()
                 throws IgniteCheckedException

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

Throws:
  `IgniteCheckedException` - If failed.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.7.0
Release Date | : August 1 2016