欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

list集合分页list分页

程序员文章站 2022-06-21 16:34:14
...
public static List<VresourcePolice> getPaginationListVresourcePolice(List<VresourcePolice> list,int start,int end){
		List<VresourcePolice> resultList =new ArrayList<>();
		for(int i=1;i<=list.size();i++){
	      if (i>=start && i<=end) {
			resultList.add(list.get(i-1));
		   }
		}
		return resultList;
	  }
 //不严谨但是能用:      
        int pageNum = sceneSimpleCountParam.getPageNum();
	    int pageSize = sceneSimpleCountParam.getPageSize();
	    int startIndex = (pageNum-1)*pageSize;
    	int endIndex = pageNum*pageSize;

       
           int total = orderList.size();
		   if (pageNum*pageSize <= total) {
			   orderList = orderList.subList(startIndex,endIndex);
			}else{
				orderList = orderList.subList(startIndex,total);
			}