T - The type of value contained in this IterableStream.P - The response extending from PagedResponsepublic class PagedIterableBase<T,P extends PagedResponse<T>> extends IterableStream<T>
PagedResponse using Stream and
Iterable interfaces.
Code sample using Stream by page
// process the streamByPage CustomPagedFlux<String> customPagedFlux = createCustomInstance();PagedIterableBase<String,PagedResponse<String>> customPagedIterableResponse = newPagedIterableBase<>(customPagedFlux); customPagedIterableResponse.streamByPage().forEach(resp -> {System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.getHeaders(), resp.getRequest().getUrl(), resp.getStatusCode()); resp.getItems().forEach(value -> {System.out.printf("Response value is %s %n", value); }); });
Code sample using Iterable by page
// process the iterableByPage
customPagedIterableResponse.iterableByPage().forEach(resp -> {
System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.getHeaders(),
resp.getRequest().getUrl(), resp.getStatusCode());
resp.getItems().forEach(value -> {
System.out.printf("Response value is %s %n", value);
});
});
Code sample using Iterable by page and while loop
// iterate over each pageIterator<PagedResponse<String>> iterator = customPagedIterableResponse.iterableByPage().iterator(); while (iterator.hasNext()) {PagedResponse<String> resp = iterator.next();System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.getHeaders(), resp.getRequest().getUrl(), resp.getStatusCode()); resp.getItems().forEach(value -> {System.out.printf("Response value is %s %n", value); }); }
PagedResponse,
IterableStream| Constructor and Description |
|---|
PagedIterableBase(PagedFluxBase<T,P> pagedFluxBase)
Creates instance given
PagedFluxBase. |
| Modifier and Type | Method and Description |
|---|---|
Iterable<P> |
iterableByPage()
Provides
Iterable API for{ @link PagedResponse}
It will provide same collection of T values from starting if called multiple times. |
Iterable<P> |
iterableByPage(String continuationToken)
Provides
Iterable API for PagedResponse, starting from the next page associated with the given
continuation token. |
Stream<P> |
streamByPage()
Retrieve the
Stream, one page at a time. |
Stream<P> |
streamByPage(String continuationToken)
Retrieve the
Stream, one page at a time, starting from the next page associated with the given
continuation token. |
iterator, streamclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic PagedIterableBase(PagedFluxBase<T,P> pagedFluxBase)
PagedFluxBase.pagedFluxBase - to use as iterablepublic Stream<P> streamByPage()
Stream, one page at a time.
It will provide same Stream of T values from starting if called multiple times.Stream of a Response that extends PagedResponsepublic Stream<P> streamByPage(String continuationToken)
Stream, one page at a time, starting from the next page associated with the given
continuation token. To start from first page, use PagedIterableBase.streamByPage() instead.continuationToken - The continuation token used to fetch the next pageStream of a Response that extends PagedResponse, starting from the page associated
with the continuation tokenpublic Iterable<P> iterableByPage()
Iterable API for{ @link PagedResponse}
It will provide same collection of T values from starting if called multiple times.Iterable interfacepublic Iterable<P> iterableByPage(String continuationToken)
Iterable API for PagedResponse, starting from the next page associated with the given
continuation token. To start from first page, use PagedIterableBase.streamByPage() instead.
It will provide same collection of T values from starting if called multiple times.continuationToken - The continuation token used to fetch the next pageIterable interfaceCopyright © 2019 Microsoft Corporation. All rights reserved.