Top Description Fields Constructors Methods
com.oracle.bmc.paginator.internal

public Class ResponseIterator<REQUESTBUILDER, REQUEST, RESPONSE>

extends AbstractResponseIterator<REQUESTBUILDER, REQUEST, RESPONSE>
implements Iterator<RESPONSE>
Class Inheritance
All Implemented Interfaces
java.util.Iterator
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
Imports
java.util.Iterator, .NoSuchElementException, java.util.function.Function

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.

Field Summary

Inherited from com.oracle.bmc.paginator.internal.AbstractResponseIterator:
currentResponsenextPageTokennextPageTokenRetrievalFunctionpageRetrievalFunctionrequestBuilderrequestBuilderFunction

Constructor Summary

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

Constructs a new ResponseIterator.

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public RESPONSE
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from com.oracle.bmc.paginator.internal.AbstractResponseIterator:
fetchNextPagegetNextPageTokengetNextRequest

Constructor Detail

ResponseIteratorback to summary
public ResponseIterator(final REQUESTBUILDER requestBuilder, final Function<RESPONSE, String> nextPageTokenRetrievalFunction, final Function<RequestBuilderAndToken<REQUESTBUILDER>, REQUEST> requestBuilderFunction, final Function<REQUEST, RESPONSE> pageRetrievalFunction)

Constructs a new ResponseIterator.

Parameters
requestBuilder:REQUESTBUILDER

a builder object which can create requests for a list operation

nextPageTokenRetrievalFunction:Function<RESPONSE, String>

a function which can extract the next page token from a response produced by a list operation

requestBuilderFunction:Function<RequestBuilderAndToken<REQUESTBUILDER>, REQUEST>

a function which can build a request for a list operation based on a builder object and a pagination token to use

pageRetrievalFunction:Function<REQUEST, RESPONSE>

a function which will call a list operation with a request and return the response of the call

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public RESPONSE next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:RESPONSE

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override