public static void main(String[] args) {
int MAX_SEND = 500;
List
list = new ArrayList<>();
for(int i=0;i<1000;i++){
list.add(i);
int limit = (list.size() + MAX_SEND - 1) / MAX_SEND;
List> mglist = new ArrayList<>();
Stream.iterate(0, n -> n + 1).limit(limit).forEach(i -> {
mglist.add(list.stream().skip(i * MAX_SEND).limit(MAX_SEND).collect(Collectors.toList()));
List> splitList = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> list.stream().skip(a * MAX_SEND).limit(MAX_SEND).parallel().collect(Collectors.toList())).collect(Collectors.toList());
for(List list1:splitList){
System.out.println("---------------------------------------------");
System.out.println(JSON.toJSONString(list1));
方法2 :直接使用公共方法操作
List<List<Map<String,Object>>> lists = ListUtils.partition(editList,1000);
for(List<Map<String,Object>> sublist: lists){
//todo sublist