mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-02 20:02:49 +08:00
add test
This commit is contained in:
parent
9a088883a1
commit
64d4d64ccc
@ -593,7 +593,7 @@ public class ListUtil {
|
|||||||
* @return 分段列表
|
* @return 分段列表
|
||||||
* @since 5.4.5
|
* @since 5.4.5
|
||||||
*/
|
*/
|
||||||
public static <T> List<List<T>> partition(final List<T> list, final int size) {
|
public static <T> List<List<T>> partition(final List<T> list, final int size) {
|
||||||
if (CollUtil.isEmpty(list)) {
|
if (CollUtil.isEmpty(list)) {
|
||||||
return empty();
|
return empty();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.dromara.hutool.core.collection;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Issue3308Test {
|
||||||
|
@Test
|
||||||
|
void partitionTest() {
|
||||||
|
final List<String> list = new ArrayList<>();
|
||||||
|
for (int i = 0; i < 100000; i++) {
|
||||||
|
list.add("Str"+i);
|
||||||
|
}
|
||||||
|
final List<List<String>> partition = ListUtil.partition(list, 1000);
|
||||||
|
Assertions.assertEquals(100, partition.size());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user