List<Integer> sourList = new ArrayList<>();
sourList = Arrays.asList(1, 2,3,4,5,6,7);
int batchCount = 3;
int sourListSize = sourList.size();
int subCount = sourListSize % batchCount == 0 ? sourListSize / batchCount : sourListSize / batchCount + 1;
int stopIndext = 0;
for (int i = 0; i < subCount; i++) {
stopIndext = (i == subCount - 1) ? sourList.size() : batchCount * i + batchCount;
List<Integer> tempList = sourList.subList(batchCount * i, stopIndext);
System.out.println(tempList);
}
List每次取100条进行处理
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 接着Java集合框架学习---深入探究ArrayList源码(二)继续学习ArrayList源码。 removeA...
- 一. ArrayList.subList()方法 ArrayList.subList(int fromIndex,...