Class PagedIterator<T>

java.lang.Object
com.okta.sdk.resource.client.PagedIterator<T>
Type Parameters:
T - The type of item in the collection (e.g., User)
All Implemented Interfaces:
Iterator<T>

public class PagedIterator<T> extends Object implements Iterator<T>
The new stateful, but *isolated*, iterator for pagination. This object is created for each loop and holds the state (the next page URL and the current page's items) for that loop *only*. It is not shared, making it thread-safe.
  • Constructor Details

    • PagedIterator

      public PagedIterator(Function<String,ApiResponse<List<T>>> pageFetcher)
      Constructs a new PagedIterator with the given page fetching strategy.
      Parameters:
      pageFetcher - A function that takes a next URL (or null for the first page) and returns an ApiResponse containing a list of items and headers.
  • Method Details

    • hasNext

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

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