# Class LimitResultIterator<T>

java.lang.Object
org.apache.cayenne.access.jdbc.LimitResultIterator<T>

All Implemented Interfaces:
  `AutoCloseable, Iterable<T>, ResultIterator<T>`

public class LimitResultIterator<T> extends Object implements ResultIterator<T>

Since:
  3.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected ResultIterator<T>`
  `delegate`
  `protected int`
  `fetchedSoFar`
  `protected int`
  `fetchLimit`
  `protected boolean`
  `nextRow`
  `protected int`
  `offset`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LimitResultIterator(ResultIterator<T> delegate, int offset, int fetchLimit)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<T>`
  `allRows()`
  Returns all yet unread rows from ResultSet without closing it.
  `void`
  `close()`
  Closes ResultIterator and associated ResultSet.
  `boolean`
  `hasNextRow()`
  Returns true if there is at least one more record that can be read from the iterator.
  `Iterator<T>`
  `iterator()`
  `T`
  `nextRow()`
  Returns the next result row that is, depending on the query, may be a scalar value, a DataRow, or an Object[] array containing a mix of scalars and DataRows.
  `void`
  `skipRow()`
  Goes past current row.

  ### Methods inherited from class Object

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

  ### Methods inherited from interface Iterable

  `forEach, spliterator`

- ## Field Details

  - ### delegate

    protected ResultIterator<T> delegate

  - ### fetchLimit

    protected int fetchLimit

  - ### offset

    protected int offset

  - ### fetchedSoFar

    protected int fetchedSoFar

  - ### nextRow

    protected boolean nextRow

- ## Constructor Details

  - ### LimitResultIterator

    public LimitResultIterator(ResultIterator<T> delegate, int offset, int fetchLimit)

- ## Method Details

  - ### iterator

    public Iterator<T> iterator()
    Specified by:
      `iterator` in interface `Iterable<T>`
    Since:
      4.0

  - ### close

    public void close()
    Description copied from interface: `ResultIterator`
    Closes ResultIterator and associated ResultSet. This method must be called explicitly when the user is finished processing the records. Otherwise unused database resources will not be released properly.
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `ResultIterator<T>`

  - ### allRows

    public List<T> allRows()
    Description copied from interface: `ResultIterator`
    Returns all yet unread rows from ResultSet without closing it.
    Specified by:
      `allRows` in interface `ResultIterator<T>`
    Since:
      3.0

  - ### hasNextRow

    public boolean hasNextRow()
    Description copied from interface: `ResultIterator`
    Returns true if there is at least one more record that can be read from the iterator.
    Specified by:
      `hasNextRow` in interface `ResultIterator<T>`

  - ### nextRow

    public T nextRow()
    Description copied from interface: `ResultIterator`
    Returns the next result row that is, depending on the query, may be a scalar value, a DataRow, or an Object[] array containing a mix of scalars and DataRows.
    Specified by:
      `nextRow` in interface `ResultIterator<T>`
    Since:
      3.0

  - ### skipRow

    public void skipRow()
    Description copied from interface: `ResultIterator`
    Goes past current row. If the row is not needed, this may save some time on data conversion.
    Specified by:
      `skipRow` in interface `ResultIterator<T>`
    Since:
      3.0