Package org.apache.calcite.avatica.util

# Class IteratorCursor<E>

java.lang.Object
org.apache.calcite.avatica.util.AbstractCursor
org.apache.calcite.avatica.util.PositionedCursor<E>
org.apache.calcite.avatica.util.IteratorCursor<E>

Type Parameters:
  `E` - Element type

All Implemented Interfaces:
  `AutoCloseable`, `Cursor`

Direct Known Subclasses:
  `ArrayIteratorCursor`, `ListIteratorCursor`, `MapIteratorCursor`, `RecordIteratorCursor`

public abstract class IteratorCursor<E> extends PositionedCursor<E>
Implementation of `Cursor` on top of an `Iterator` that returns a record for each row. The returned record is cached to avoid multiple computations of current row.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.apache.calcite.avatica.util.PositionedCursor

`PositionedCursor.ArrayGetter, PositionedCursor.FieldGetter, PositionedCursor.ListGetter, PositionedCursor.MapGetter<K>, PositionedCursor.ObjectGetter`

## Nested classes/interfaces inherited from class org.apache.calcite.avatica.util.AbstractCursor

`AbstractCursor.AbstractGetter, AbstractCursor.ArrayAccessor, AbstractCursor.Getter, AbstractCursor.SlotGetter, AbstractCursor.StructGetter`

## Nested classes/interfaces inherited from interface org.apache.calcite.avatica.util.Cursor

`Cursor.Accessor`

## Field Summary

### Fields inherited from class org.apache.calcite.avatica.util.AbstractCursor

`wasNull`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`IteratorCursor(Iterator<E> iterator)`
Creates an `IteratorCursor`.

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
Closes this cursor and releases resources.
`protected E`
`current()`
Returns the current row.
`boolean`
`next()`
Moves to the next row.

### Methods inherited from class org.apache.calcite.avatica.util.AbstractCursor

`createAccessor, createAccessor, createAccessors, createGetter, wasNull`

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

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

## Constructor Details

### IteratorCursor

protected IteratorCursor(Iterator<E> iterator)
Creates an `IteratorCursor`.

Parameters:
  `iterator` - input iterator

## Method Details

### next

public boolean next()
Description copied from interface: `Cursor`
Moves to the next row.

Specified by:
  `next` in interface `Cursor`
Specified by:
  `next` in class `AbstractCursor`
Returns:
  Whether moved

### close

public void close()
Description copied from interface: `Cursor`
Closes this cursor and releases resources.

### current

protected E current()
Description copied from class: `PositionedCursor`
Returns the current row.

Specified by:
  `current` in class `PositionedCursor<E>`
Returns:
  current row