com.apple.foundationdb.async

## Interface CloseableAsyncIterator<T>

Type Parameters:
  `T` - the type of object yielded by `next()`

All Superinterfaces:
  AsyncIterator<T>, java.lang.AutoCloseable, java.util.Iterator<T>

    public interface CloseableAsyncIterator<T>
    extends java.lang.AutoCloseable, AsyncIterator<T>

A version of `AsyncIterator` that must be closed once no longer in use in order to free any associated resources.

### Method Summary

All Methods Instance Methods Abstract Methods Default Methods
`default void` `cancel()` Alias for `close()`.
`void` `close()` Cancels any outstanding asynchronous work, closes the iterator, and frees any associated resources.

### Methods inherited from interface com.apple.foundationdb.async.AsyncIterator

`hasNext, next, onHasNext`

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

`forEachRemaining, remove`

### Method Detail

#### close

    void close()

Cancels any outstanding asynchronous work, closes the iterator, and frees any associated resources. This must be called at least once after the object is no longer in use. This can be called multiple times, but care should be taken that an object is not in use in another thread at the time of the call.

Specified by:
  `close` in interface `java.lang.AutoCloseable`

#### cancel

    default void cancel()

Alias for `close()`.

Specified by:
  `cancel` in interface `AsyncIterator<T>`