修复Partition计算size除数为0报错问题

This commit is contained in:
Looly 2022-10-24 12:09:31 +08:00
parent 5c835ef888
commit 4c0d594e99
2 changed files with 6 additions and 1 deletions

View File

@ -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)

View File

@ -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;}