/**
* @param list 分页数据
* @param pageSize 页面大小
* @param currentPage 当前页面
*/
public List<DTO> pageBySubList(List<DTO> list, Integer pageSize, Integer currentPage) {
//总条数
int totalcount = list.size();
List<DTO> afterList = new ArrayList<>();
int total = (currentPage - 1) * pageSize;
for (int i = total; i < (Math.min(total + pageSize, totalcount)); i++) {
//然后将数据存入afterList中
afterList.add(list.get(i));
}
//然后将处理后的数据集合进行返回
return afterList;
}
手动分页list
最新推荐文章于 2024-03-08 06:00:00 发布