# Page

Canonical page: https://docs.ovok.com/java-sdk/reference/page

```java
public final class Page<T> implements Iterable<T>
```

One page of results that can iterate through every later page.

Iterating loads the next pages on demand:

```java
for (JsonNode patient : ovok.slim().patients().list(Map.of(), RequestOptions.defaults())) {
    System.out.println(patient.path("id").asString());
}
```

**Type parameters:**

- `<T>`: the item type

## Methods [#methods]

### data [#data]

```java
public List<T> data()
```

Returns the items on this page only.

**Returns:** the items

### hasMore [#hasmore]

```java
public boolean hasMore()
```

Returns whether a later page exists.

**Returns:** `true` if a later page exists

### total [#total]

```java
public Long total()
```

Returns the total item count across all pages, when the server reports it.

**Returns:** the total, or `null` if unknown

### iterator [#iterator]

```java
public Iterator<T> iterator()
```

Iterates this page's items, then every later page's items.

**Returns:** the iterator

### numbered [#numbered]

```java
public static Page<JsonNode> numbered(Function<Integer, JsonNode> load, int firstPage)
```

Pages a page-numbered response (`resources`, `page`, `count`, `total`).

**Parameters:**

- `load`: loads the response for a page number
- `firstPage`: the first page number

**Returns:** the first page

### cursor [#cursor]

```java
public static Page<JsonNode> cursor(Function<String, JsonNode> load)
```

Pages a cursor response (`items`, `nextCursor`).

**Parameters:**

- `load`: loads the response for a cursor; the first call gets `null`

**Returns:** the first page

### payload [#payload]

```java
public static Page<JsonNode> payload(Function<Integer, JsonNode> load, Integer firstPage)
```

Pages a Payload CMS response (`docs`, `nextPage`, `totalDocs`).

**Parameters:**

- `load`: loads the response for a page number
- `firstPage`: the first page number, or `null` for the server default

**Returns:** the first page
