int count = zoroEntityMasterService.count();
int total = count;//数据总量
int row = 6000;//页显示条数 239223 239344
int totalPages;//总页数
totalPages = total / row;
if (total % row != 0) {
totalPages++;
}
public static <T> List<List<T>> averageAssign(List<T> source, int n) {
List<List<T>> result = new ArrayList<List<T>>();
int remainder = source.size() % n; //(先计算出余数)
int number = source.size() / n; //然后是商
int offset = 0;//偏移量
for (int i = 0; i < n; i++) {
List<T> value = null;
if (remainder > 0) {
value = source.subList(i * number + offset, (i + 1) * number + offset + 1);
remainder--;
offset++;
} else {
value = source.subList(i * number + offset, (i + 1) * number + offset);
}
result.add(value);
}
return result;
}
jdk7版本List分组
最新推荐文章于 2024-03-05 23:05:35 发布