This commit is contained in:
wulang 2023-03-29 18:57:02 +08:00
parent d343051db5
commit 2a8444b11f
2 changed files with 3 additions and 3 deletions

View File

@ -1189,7 +1189,7 @@ public class CollUtil {
return result;
}
int initSize = Math.min(collection.size(), size);
final int initSize = Math.min(collection.size(), size);
List<T> subList = new ArrayList<>(initSize);
for (T t : collection) {
if (subList.size() >= size) {

View File

@ -259,8 +259,8 @@ public class CollUtilTest {
public void splitTest2() {
final ArrayList<Integer> list = CollUtil.newArrayList(1, 2, 3, 4, 5, 6, 7, 8, 9);
final List<List<Integer>> split = CollUtil.split(list, Integer.MAX_VALUE);
Assert.assertEquals(3, split.size());
Assert.assertEquals(3, split.get(0).size());
Assert.assertEquals(1, split.size());
Assert.assertEquals(9, split.get(0).size());
}
@Test