Package com.azure.core.http.rest
Class PagedIterableBase<T,P extends PagedResponse<T>>
- java.lang.Object
-
- com.azure.core.util.IterableStream<T>
-
- com.azure.core.util.paging.ContinuablePagedIterable<String,T,P>
-
- com.azure.core.http.rest.PagedIterableBase<T,P>
-
- Type Parameters:
T
- The type of value contained in thisIterableStream
.P
- The response extending fromPagedResponse
- All Implemented Interfaces:
Iterable<T>
- Direct Known Subclasses:
PagedIterable
public class PagedIterableBase<T,P extends PagedResponse<T>> extends ContinuablePagedIterable<String,T,P>
This class provides utility to iterate over responses that extendPagedResponse
usingStream
andIterable
interfaces.Code sample using
Stream
by page// process the streamByPage CustomPagedFlux<String> customPagedFlux = createCustomInstance(); PagedIterableBase<String, PagedResponse<String>> customPagedIterableResponse = new PagedIterableBase<>(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.getElements().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.getElements().forEach(value -> System.out.printf("Response value is %s %n", value)); });
Code sample using
Iterable
by page and while loop// iterate over each page for (PagedResponse<String> resp : customPagedIterableResponse.iterableByPage()) { System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.getHeaders(), resp.getRequest().getUrl(), resp.getStatusCode()); resp.getElements().forEach(value -> System.out.printf("Response value is %s %n", value)); }
- See Also:
PagedResponse
,IterableStream
-
-
Constructor Summary
Constructors Constructor Description PagedIterableBase(PagedFluxBase<T,P> pagedFluxBase)
Creates instance givenPagedFluxBase
.
-
Method Summary
-
Methods inherited from class com.azure.core.util.paging.ContinuablePagedIterable
iterableByPage, iterableByPage, iterableByPage, iterableByPage, iterator, stream, streamByPage, streamByPage, streamByPage, streamByPage
-
Methods inherited from class com.azure.core.util.IterableStream
of
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
PagedIterableBase
public PagedIterableBase(PagedFluxBase<T,P> pagedFluxBase)
Creates instance givenPagedFluxBase
.- Parameters:
pagedFluxBase
- to use as iterable
-
-