public AsyncPage next()

in src/main/java/com/spotify/github/v3/clients/GithubPageIterator.java [61:80]


  public AsyncPage<T> next() {
    synchronized (lock) {
      if (isNull(current)) {
        throw new NoSuchElementException("Iteration exhausted");
      }

      final AsyncPage<T> currentPage = current.clone();
      current =
          current
              .hasNextPage()
              .thenCompose(
                  hasNext ->
                      Optional.of(hasNext)
                          .filter(Boolean::booleanValue)
                          .map(ignore -> current.nextPage())
                          .orElseGet(() -> completedFuture(null)))
              .join();
      return currentPage;
    }
  }