公告
财富商城
积分规则
提问
发文
2019-01-01 12:24发布
泛滥B
How can I split an ArrayList (size=1000) in multiple ArrayLists of the same size (=10) ?
ArrayList<Integer> results;
Apache Commons Collections 4 has a partition method in the ListUtils class. Here’s how it works:
ListUtils
import org.apache.commons.collections4.ListUtils; ... int targetSize = 100; List<Integer> largeList = ... List<List<Integer>> output = ListUtils.partition(largeList, targetSize);
最多设置5个标签!
Apache Commons Collections 4 has a partition method in the
ListUtils
class. Here’s how it works: