org.apache.ignite.internal.cache.query.index

## Class SingleCursor<T>

- java.lang.Object
- - org.apache.ignite.internal.cache.query.index.SingleCursor<T>

Type Parameters:
  `T` - class of value to return.

All Implemented Interfaces:
  GridCursor<T>

    public class SingleCursor<T>
    extends Object
    implements GridCursor<T>

Cursor that holds single value only.

### Constructor Summary

Constructors
Constructor and Description
`SingleCursor(T val)`

### Method Summary

All Methods Instance Methods Concrete Methods
`T` `get()` Note that this implementation violates the contract of GridCusror.
`boolean` `next()` Attempt to move cursor position forward.

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

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

### Constructor Detail

#### SingleCursor

    public SingleCursor(T val)

### Method Detail

#### next

    public boolean next()

Attempt to move cursor position forward.

Specified by:
  `next` in interface `GridCursor<T>`
Returns:
  `true` If we were able to move position of cursor forward.

#### get

    public T get()
          throws IgniteCheckedException

Note that this implementation violates the contract of GridCusror. It must be "before first" but this implementation handles both cases: "before first" and "on first". Current implementation of SQL with H2 relies on this `null` for queries like "select max(col) from table". This should be fixed for other SQL engines. https://issues.apache.org/jira/browse/IGNITE-14303.

Specified by:
  `get` in interface `GridCursor<T>`
Returns:
  Element at current position.
Throws:
  `IgniteCheckedException` - If failed.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.16.0
Release Date | : December 15 2023