I have one requirement is to search by pageable and non-pageable,
and in my Java code, I use spring data jpa Pageable class,
Pageable pageable = new
pageable = PageRequest.of(0, Integer.MAX_VALUE);
if overriding pageable based on some condition, better to not change sort, just pass on
// pageable is coming from function
if(!isPageable)
pageable = PageRequest.of(0, Integer.MAX_VALUE, pageable.getSort());
PageRequest's package org.springframework.data.domain.PageRequest