Class PagedIterator<T>

java.lang.Object
org.kohsuke.github.PagedIterator<T>
Type Parameters:
T - the type parameter
All Implemented Interfaces:
Iterator<T>

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.

Author:
Kohsuke Kawaguchi
  • Field Details

  • Method Details

    • 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.
      Parameters:
      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.
      Returns:
      the list