NewProject Coding is here — build features and fix bugs in real codebases with an AI assistantSee what's new

Design a PaginationAPI to sequentially retrieve items from an external data source, ExternalPaginatedAPI.

The provided external class ExternalPaginatedAPI only allows you to fetch data by page number using the getPage(int pageNum) method. The number of items in each page is not fixed, and you do not have access to the entire dataset. You only have access to the provided API methods.

The external API is structured as follows:

class ExternalPaginatedAPI {
    List<List<String>> pageContents;
    public ExternalPaginatedAPI(List<List<String>> pageContents) { ... }
    public List<String> getPage(int pageNum) { ... }
}

Implement the PaginationAPI class:

Stdout
-