? 在编程时通常会遇到一些问题,有时候是不知所措,有时候是解决方案不够优雅,本篇旨在记录编程过程中一些个人想不到的,稍微优雅一点的解决方案,方案来源均来自互联网。
int subSize = 1000;
int subCount = list.size();
int subPageTotal = (subCount / subSize) + ((subCount % subSize > 0) ? 1 : 0);
// 根据页码取数据
for (int i = 0, len = subPageTotal - 1; i <= len; i++) {
// 分页计算
int fromIndex = i * subSize;
int toIndex = ((i == len) ? subCount : ((i + 1) * subSize));
List<String> strings = list.subList(fromIndex, toIndex);
}
原文:https://www.cnblogs.com/coderzhw/p/11094326.html