Interface FixedSizeCollection<ResourceT> (2.22.0)

public interface FixedSizeCollection<ResourceT>

A FixedSizeCollection object wraps multiple API list method responses into a single collection with a fixed number of elements.

Callers can iterate over the FixedSizeCollection object to get all elements in the collection. The number of elements is guaranteed to be equal to the value of the collectionSize parameter passed to expandPage(), unless the API has no more elements to return. The FixedSizeCollection object also provides methods to retrieve additional FixedSizeCollections using the page token.

Type Parameter

NameDescription
ResourceT

Methods

getCollectionSize()

public abstract int getCollectionSize()

Returns the number of elements in the collection. This will be equal to the collectionSize parameter used at construction unless there are no elements remaining to be retrieved.

Returns
TypeDescription
int

getNextCollection()

public abstract FixedSizeCollection<ResourceT> getNextCollection()

Retrieves the next FixedSizeCollection using one or more API calls.

Returns
TypeDescription
FixedSizeCollection<ResourceT>

getNextPageToken()

public abstract String getNextPageToken()

Returns a page token that can be passed into the API list method to retrieve additional elements.

Returns
TypeDescription
String

getValues()

public abstract Iterable<ResourceT> getValues()

Returns an iterable over the elements in this FixedSizeCollection.

Returns
TypeDescription
Iterable<ResourceT>

hasNextCollection()

public abstract boolean hasNextCollection()

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

Returns
TypeDescription
boolean