org.apache.ignite.cache.query

## Interface QueryCursor<T>

All Superinterfaces:
  AutoCloseable, Iterable<T>

All Known Subinterfaces:
  FieldsQueryCursor<T>, QueryCursorEx<T>

All Known Implementing Classes:
  BulkLoadContextCursor, QueryCursorImpl

    public interface QueryCursor<T>
    extends Iterable<T>, AutoCloseable

Query result cursor. Implements `Iterable` only for convenience, e.g. `Iterable.iterator()` can be obtained only once. Also if iteration is started then `getAll()` method calls are prohibited.

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `close()` Closes all resources related to this cursor.
`List<T>` `getAll()` Gets all query results and stores them in the collection.

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

`forEach, iterator, spliterator`

### Method Detail

#### getAll

    List<T> getAll()

Gets all query results and stores them in the collection. Use this method when you know in advance that query result is relatively small and will not cause memory utilization issues.

Since all the results will be fetched, all the resources will be closed automatically after this call, e.g. there is no need to call `close()` method in this case.

Returns:
  List containing all query results.

#### close

    void close()

Closes all resources related to this cursor. If the query execution is in progress (which is possible in case of invoking from another thread), a cancel will be attempted. Sequential calls to this method have no effect.

Note: don't forget to close query cursors. Not doing so may lead to various resource leaks.

Specified by:
  `close` in interface `AutoCloseable`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023