Class PagedIterable<T>

  • Type Parameters:
    T - The type of page elements contained in this PagedIterable.
    All Implemented Interfaces:
    java.lang.Iterable<T>

    public class PagedIterable<T>
    extends java.lang.Object
    implements java.lang.Iterable<T>
    PagedIterable provides the ability to enumerate paginated REST responses of type PagedResponse and individual elements in such pages using Iterable interface. When processing the response by page each response will contain the elements in the page as well as the REST response details such as status code and headers.
    • Constructor Summary

      Constructors 
      Constructor Description
      PagedIterable​(com.azure.android.core.util.Function<java.lang.String,​PagedResponse<T>> pageRetriever, com.azure.android.core.util.Predicate<java.lang.String> continuationPredicate, com.azure.android.core.logging.ClientLogger logger)
      Creates an instance of PagedIterable.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Iterable<PagedResponse<T>> byPage()
      Gets a Iterable of PagedResponse starting at the first page.
      java.lang.Iterable<PagedResponse<T>> byPage​(java.lang.String startPageId)
      Gets a Iterable of PagedResponse beginning at the page identified by the given token.
      PagedResponse<T> getPage​(java.lang.String pageId)
      Retrieve a page with given id pageId.
      java.util.Iterator<T> iterator()  
      java.util.Iterator<T> iterator​(java.lang.String startPageId)
      Gets a Iterable of PagedIterable beginning at the page identified by the given token.
      • 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

      • PagedIterable

        public PagedIterable​(com.azure.android.core.util.Function<java.lang.String,​PagedResponse<T>> pageRetriever,
                             com.azure.android.core.util.Predicate<java.lang.String> continuationPredicate,
                             com.azure.android.core.logging.ClientLogger logger)
        Creates an instance of PagedIterable.
        Parameters:
        pageRetriever - The page retriever.
        continuationPredicate - A predicate which determines if paging should continue.
        logger - The logger to log.
    • Method Detail

      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T>
      • byPage

        public java.lang.Iterable<PagedResponse<T>> byPage​(java.lang.String startPageId)
        Gets a Iterable of PagedResponse beginning at the page identified by the given token.
        Parameters:
        startPageId - A continuation token identifying the page to select.
        Returns:
        A Iterable of PagedResponse.
      • iterator

        public java.util.Iterator<T> iterator​(java.lang.String startPageId)
        Gets a Iterable of PagedIterable beginning at the page identified by the given token.
        Parameters:
        startPageId - A continuation token identifying the page to select.
        Returns:
        A Iterable of PagedIterable.
      • getPage

        public PagedResponse<T> getPage​(java.lang.String pageId)
        Retrieve a page with given id pageId. A null value for pageId indicate the initial page.
        Parameters:
        pageId - The id of the page to retrieve.
        Returns:
        The page with given id.