> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RecordRetriever.Lookup

> RecordRetriever.Lookup — Kinetica Java API

Package [com.gpudb](https://docs.kinetica.com/content/api/java/com/gpudb/package-summary.md)

# Class RecordRetriever.Lookup

[java.lang.Object](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html)
com.gpudb.RecordRetriever.Lookup

All Implemented Interfaces:`Iterable<T>`

Enclosing class:`RecordRetriever<T>`

***

public final class RecordRetriever.Lookup extends [Object](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html) implements [Iterable](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Iterable.html)\<T>

The records one lookup returns, read a page at a time in a single pass.
&#x20;On a replicated table every page is taken from one worker rank, drawn at random when the first page is read: each rank holds the whole table in an order of its own, so a page from another rank could repeat or skip records. A lookup made with [`RecordRetriever.getByKey(List, String, long)`](https://docs.kinetica.com/content/api/java/com/gpudb/RecordRetriever#getByKey\(java.util.List,java.lang.String,long\)) and an offset has no such identity -- one call cannot know whether the next is its next page -- so those send every call with one expression to one rank per retriever; a lookup made here is spread over the ranks lookup by lookup. Should the routing be rebuilt during the pass -- the rank leaving the cluster, a fail-over, a change of shard mapping -- the pass fails rather than go on from another rank.&#x20;
&#x20;[`size()`](#size\(\)) is the number of records the lookup matches, known once its first page has been read; asking for it reads that page.

<ul>
  <li>
    ## Method Summary

    All MethodsInstance MethodsConcrete Methods

    Modifier and TypeMethodDescription`Iterator<T>``iterator()` `long``size()` 

    Methods inherited from class java.lang.[Object](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html)
    `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    Methods inherited from interface java.lang.[Iterable](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Iterable.html)
    `forEach, spliterator`
  </li>
</ul>

<ul>
  <li>
    ## Method Details

    <ul>
      <li>
        ### size

        public long size() throws [GPUdbException](https://docs.kinetica.com/content/api/java/com/gpudb/GPUdbException.md)

        Returns:how many records the lookup matches in all; reads the first page if none has been readThrows:`GPUdbException` - if the page cannot be read
      </li>

      <li>
        ### iterator

        public [Iterator](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Iterator.html)\<[T](https://docs.kinetica.com/content/api/java/com/gpudb/RecordRetriever.md)> iterator()

        Specified by:`iterator` in interface `Iterable<T>`
      </li>
    </ul>
  </li>
</ul>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.