Skip to content

Commit 0ff8feb

Browse files
committed
fix: when maxSize equals to 0, an ArithmaticException will be raised
1 parent 94e7307 commit 0ff8feb

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

devkit-utils/src/main/java/com/onixbyte/devkit/utils/CollectionUtil.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
*/
3434
public final class CollectionUtil {
3535

36-
private static final Logger log = LoggerFactory.getLogger(CollectionUtil.class);
37-
3836
/**
3937
* Private constructor to prevent instantiation of this utility class.
4038
*/
@@ -68,7 +66,7 @@ public static <T, C extends Collection<T>> List<C> chunk(C originalCollection,
6866
throw new IllegalArgumentException("Collection must not be null.");
6967
}
7068

71-
if (maxSize < 0) {
69+
if (maxSize <= 0) {
7270
throw new IllegalArgumentException("maxSize must greater than 0.");
7371
}
7472

0 commit comments

Comments
 (0)