Class ResponseIterator<REQUESTBUILDER,​REQUEST,​RESPONSE>

  • Type Parameters:
    REQUESTBUILDER - the type of a builder which can produce requests for a list operation
    REQUEST - the type of a request to a list operation. This type must match the type produced by REQUESTBUILDER
    RESPONSE - the type of the response from a list operation
    All Implemented Interfaces:
    Iterator<RESPONSE>

    public class ResponseIterator<REQUESTBUILDER,​REQUEST,​RESPONSE>
    extends AbstractResponseIterator<REQUESTBUILDER,​REQUEST,​RESPONSE>
    implements Iterator<RESPONSE>
    An iterator for iterating over response objects returned from a list operation.

    Each time we advance the iterator (via its next() method) we will call the list operation of the service for the next response.

    This iterator does not support removal of elements.

    • Constructor Detail

      • ResponseIterator

        public ResponseIterator​(REQUESTBUILDER requestBuilder,
                                Function<RESPONSE,​String> nextPageTokenRetrievalFunction,
                                Function<RequestBuilderAndToken<REQUESTBUILDER>,​REQUEST> requestBuilderFunction,
                                Function<REQUEST,​RESPONSE> pageRetrievalFunction)
        Constructs a new ResponseIterator.
        Parameters:
        requestBuilder - a builder object which can create requests for a list operation
        nextPageTokenRetrievalFunction - a function which can extract the next page token from a response produced by a list operation
        requestBuilderFunction - a function which can build a request for a list operation based on a builder object and a pagination token to use
        pageRetrievalFunction - a function which will call a list operation with a request and return the response of the call