mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
修复Partition计算size除数为0报错问题
This commit is contained in:
parent
5c835ef888
commit
4c0d594e99
@ -3,12 +3,13 @@
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# 5.8.10.M1 (2022-10-23)
|
||||
# 5.8.10.M1 (2022-10-24)
|
||||
|
||||
### 🐣新特性
|
||||
|
||||
### 🐞Bug修复
|
||||
* 【db 】 修复分页时order by截断问题(issue#I5X6FM@Gitee)
|
||||
* 【db 】 修复Partition计算size除数为0报错问题(pr#2677@Github)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.8.9 (2022-10-22)
|
||||
|
@ -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;}
|
||||
|
Loading…
x
Reference in New Issue
Block a user