code: public static <T> Page<T> convertToSpringDataPage(PagedList<T> pagedList, Sort sort) {
          return new PageImpl<T>(pagedList.getList(),
                  PageRequest.of(pagedList.getPageIndex(), pagedList.getPageSize(), sort),
                  pagedList.getTotalCount());
      }
docs: Convert Ebean PagedList with Sort to Spring data Page.
  
  @param pagedList
  @param sort
  @param <T>
  @return