PagedIterableBase<T,P> Class
- java.
lang. Object - com.
azure. core. util. IterableStream<T> - com.
azure. core. util. paging. ContinuablePagedIterable<C,T,P> - com.
azure. core. http. rest. PagedIterableBase<T,P>
- com.
- com.
- com.
Type Parameters
- T
The type of value contained in this IterableStream.
- P
The response extending from PagedResponse
public class PagedIterableBase<T,P>
extends ContinuablePagedIterable<String,T,P>
This class provides utility to iterate over responses that extend PagedResponse<T> using Stream and Iterable 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));
}
Constructor Summary
Constructor | Description |
---|---|
PagedIterableBase(PagedFluxBase<T,P> pagedFluxBase) |
Creates instance given PagedFluxBase<T,P>. |
PagedIterableBase(Supplier<PageRetrieverSync<String,P>> provider) |
Creates instance given the PageRetrieverSync<C,P> Supplier. |
Methods inherited from IterableStream
Methods inherited from ContinuablePagedIterable
Methods inherited from java.lang.Object
Constructor Details
PagedIterableBase
public PagedIterableBase(PagedFluxBase
Creates instance given PagedFluxBase<T,P>.
Parameters:
PagedIterableBase
public PagedIterableBase(Supplier
Creates instance given the PageRetrieverSync<C,P> Supplier.
Parameters: