Class PagedIterator<T>

  • Type Parameters:
    T - the type parameter
    All Implemented Interfaces:

    public class PagedIterator<T>
    extends Object
    implements Iterator<T>
    Iterator over a paginated data source. Iterates of the content items of each page, automatically requesting new pages as needed.

    Aside from the normal iterator operation, this method exposes nextPage() and nextPageArray() that allows the caller to retrieve entire pages. This class is not thread-safe. Any one instance should only be called from a single thread.

    Kohsuke Kawaguchi
    • Method Detail

      • wrapUp

        protected void wrapUp​(T[] page)
        This poorly named method, initializes items with local data after they are fetched. It is up to the implementer to decide what local data to apply.
        page - the page of items to be initialized
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface Iterator<T>
      • next

        public T next()
        Specified by:
        next in interface Iterator<T>
      • nextPage

        public List<T> nextPage()
        Gets the next page worth of data.
        the list