内存分页
public static <T> PageResult<T> newPage(List<T> content, Integer pageNum, Integer pages) {
int total = content.size();
int offset = (pageNum -1 ) * pages;
if (offset > total) {
return new PageResult<T>(null, pageNum, pages, (long)total);
}
final List<T> paged = content.subList(offset, Math.min(total, offset + pages));
return new PageResult<T>(paged, pageNum, pages, (long)total);
}
浙公网安备 33010602011771号