Interface Slice<T>

Type Parameters:
T - query result type (entity or entity attribute)
All Superinterfaces:
Iterable<T>
All Known Subinterfaces:
Page<T>

public interface Slice<T> extends Iterable<T>
Pageable query result as pages without total size of the result.

Page number and number of records returned on each page depends on values of the request() used to return current page.

Slice does not contain value of total size of the result across all pages, so it's performance should be better than Page.

  • Method Details

    • create

      static <T> Slice<T> create(PageRequest request, List<T> content)
      Create pageable query result as page without total size of the result.
      Type Parameters:
      T - query result type (entity or entity attribute)
      Parameters:
      request - pageable query result request
      content - page content as List<T>
      Returns:
      new instance of the query result
    • stream

      Stream<T> stream()
      Current page content as Stream of query result type Slice. Never returns null.
      Returns:
      current page content as Stream
    • list

      List<T> list()
      Current page content as List of query result type Slice. Never returns null.
      Returns:
      current page content as Stream
    • request

      PageRequest request()
      Pageable query result request of current page. Never returns null.
      Returns:
      current page request