/** * Eagerly fetches all the elements page by page and returns an iterable of them. * * @param supplier pages supplier * @param size how many items to retrieve per page * @param <E> the type of the element held by page * @param <X> the type of exception thrown by page supplier * @return iterable of fetched elements * @throws X when supplier throws exception */ public static <E, X extends Exception> Iterable<E> iterate(PageSupplier<E, X> supplier, int size) throws X { return eagerFetch(supplier, size); }
/** * Eagerly fetches all the elements page by page and returns a stream of them. * * @param supplier page supplier * @param size how many items to retrieve per page * @param <E> the type of the element held by page * @param <X> the type of exception thrown by page supplier * @return stream of fetched elements * @throws X when supplier throws exception */ public static <E, X extends Exception> Stream<E> stream(PageSupplier<E, X> supplier, int size) throws X { return eagerFetch(supplier, size).stream(); }