Class PageableExecutionUtils


public abstract class PageableExecutionUtils extends Object
Support for query execution using Pageable. Using PageableExecutionUtils assumes that data queries are cheaper than COUNT queries and so some cases can take advantage of optimizations.
Mark Paluch, Oliver Gierke, Christoph Strobl, Jens Schauder
  • Method Details

    • getPage

      public static <T> Page<T> getPage(List<T> content, Pageable pageable, LongSupplier totalSupplier)
      Constructs a Page based on the given content, Pageable and LongSupplier applying optimizations. The construction of Page omits a count query if the total can be determined based on the result size and Pageable.
      content - result of a query with applied Pageable. The list must not be null and must contain up to Pageable.getPageSize() items.
      pageable - must not be null.
      totalSupplier - must not be null.
      the Page for content and a total size.