Interface Page<ResourceT> (2.72.2)

publicinterfacePage<ResourceT>

A Page object wraps an API list method response.

Callers can iterate over the Page object to get all elements returned in the page. The Page object also provides methods to retrieve additional pages using the page token, and to get the API request and response objects.

Type Parameter

NameDescription
ResourceT

Methods

getNextPage()

publicabstractPage<ResourceT>getNextPage()

Retrieves the next Page object using the next page token, ornull if there are no more pages. The hasNextPage() method can be used to check if a Page object is available.

Returns
TypeDescription
Page<ResourceT>

getNextPageToken()

publicabstractStringgetNextPageToken()

Returns the next page token from the response, or an empty string if there are no more pages.

Returns
TypeDescription
String

getValues()

publicabstractIterable<ResourceT>getValues()

Returns an iterable over the elements in this page.

Returns
TypeDescription
Iterable<ResourceT>

hasNextPage()

publicabstractbooleanhasNextPage()

Returns true if there are more pages that can be retrieved from the API.

Returns
TypeDescription
boolean

iterateAll()

publicabstractIterable<ResourceT>iterateAll()

Returns an iterable that traverses all the elements of the underlying data source. The data is fetched lazily page by page, where each page may contain multiple elements. A new page is fetched whenever the elements of any particular page are exhausted.

Returns
TypeDescription
Iterable<ResourceT>

streamAll()

publicdefaultStream<ResourceT>streamAll()

Returns a stream that traverses all the elements of the underlying data source. The data is fetched lazily page by page, where each page may contain multiple elements. A new page is fetched whenever the elements of any particular page are exhausted.

Returns
TypeDescription
Stream<ResourceT>

streamValues()

publicdefaultStream<ResourceT>streamValues()

Returns a stream over the elements in this page.

Returns
TypeDescription
Stream<ResourceT>

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-17 UTC.