mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复Partition计算size除数为0报错问题
This commit is contained in:
@@ -42,6 +42,10 @@ public class Partition<T> extends AbstractList<List<T>> {
|
||||
public int size() {
|
||||
// 此处采用动态计算,以应对list变
|
||||
final int size = this.size;
|
||||
if(0 == size){
|
||||
return 0;
|
||||
}
|
||||
|
||||
final int total = list.size();
|
||||
// 类似于判断余数,当总数非整份size时,多余的数>=1,则相当于被除数多一个size,做到+1目的
|
||||
// 类似于:if(total % size > 0){length += 1;}
|
||||
|
Reference in New Issue
Block a user