Package com.azure.core.http.rest
Class PagedIterable<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,PagedResponse<T>>
-
- com.azure.core.http.rest.PagedIterable<T>
-
- Type Parameters:
T
- The type of value contained in thisIterableStream
.
- All Implemented Interfaces:
Iterable<T>
public class PagedIterable<T> extends PagedIterableBase<T,PagedResponse<T>>
This class provides utility to iterate overPagedResponse
usingStream
andIterable
interfaces.Code sample using
Stream
by page// process the streamByPage pagedIterableResponse.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 %d %n", value)); });
Code sample using
Iterable
by page// process the iterableByPage pagedIterableResponse.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 %d %n", value)); });
Code sample using
Iterable
by page and while loop// iterate over each page for (PagedResponse<Integer> resp : pagedIterableResponse.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 %d %n", value)); }
- See Also:
PagedResponse
,IterableStream
-
-
Constructor Summary
Constructors Constructor Description PagedIterable(PagedFlux<T> pagedFlux)
Creates instance givenPagedFlux
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <S> PagedIterable<S>
mapPage(Function<T,S> mapper)
Maps this PagedIterable instance of T to a PagedIterable instance of type S as per the provided mapper function.-
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
-
-
-
-
Method Detail
-
mapPage
public <S> PagedIterable<S> mapPage(Function<T,S> mapper)
Maps this PagedIterable instance of T to a PagedIterable instance of type S as per the provided mapper function.- Type Parameters:
S
- The mapped type.- Parameters:
mapper
- The mapper function to convert from type T to type S.- Returns:
- A PagedIterable of type S.
-
-