List<String> objectList = Arrays.asList("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "10");
int splitSize = 5;
int maxSize = (objectList.size() + splitSize - 1) / splitSize;
List<List<String>> flexValueLists = Stream.iterate(0, n -> n + 1)
.limit(maxSize)
.map(a -> objectList.stream().skip(a * splitSize).limit(splitSize).collect(Collectors.toList()))
.collect(Collectors.toList());
System.out.println(flexValueLists);
05-31
791
03-15
955
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交