0
点赞
收藏
分享

微信扫一扫

对list进行分页操作

飞空之羽 2022-01-20 阅读 49
     List<Object> list = new ArrayList<>();
        int total = list.size();
		int startIndex = (pageNo - 1) * pageSize;
		if (startIndex> total){
			startIndex=startIndex-1;
		}
		int endIndex = startIndex + pageSize;
		if (endIndex > total) {
			endIndex = total;
		}
		list=list.subList(startIndex,endIndex);
		return list;
举报

相关推荐

0 条评论