mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
add null check
This commit is contained in:
parent
b2201873ea
commit
3f6112fcfa
@ -12,6 +12,8 @@
|
|||||||
* 【json 】 JSONObject和JSONArray增加set方法,标识put弃用
|
* 【json 】 JSONObject和JSONArray增加set方法,标识put弃用
|
||||||
* 【http 】 增加SimpleHttpServer
|
* 【http 】 增加SimpleHttpServer
|
||||||
* 【script 】 增加createXXXScript,区别单例
|
* 【script 】 增加createXXXScript,区别单例
|
||||||
|
* 【core 】 修改FileUtil.writeFileToStream等方法返回值为long
|
||||||
|
* 【core 】 CollUtil.split增加空集合判定(issue#814@Github)
|
||||||
|
|
||||||
### Bug修复
|
### Bug修复
|
||||||
* 【extra 】 修复SpringUtil使用devtools重启报错问题
|
* 【extra 】 修复SpringUtil使用devtools重启报错问题
|
||||||
|
@ -21,7 +21,6 @@ import cn.hutool.core.util.TypeUtil;
|
|||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.AbstractCollection;
|
import java.util.AbstractCollection;
|
||||||
import java.util.AbstractMap;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -824,7 +823,7 @@ public class CollUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建Map<br>
|
* 创建Map<br>
|
||||||
* 传入抽象Map{@link AbstractMap}和{@link Map}类将默认创建{@link HashMap}
|
* 传入AbstractMap和{@link Map}类将默认创建{@link HashMap}
|
||||||
*
|
*
|
||||||
* @param <K> map键类型
|
* @param <K> map键类型
|
||||||
* @param <V> map值类型
|
* @param <V> map值类型
|
||||||
@ -923,6 +922,9 @@ public class CollUtil {
|
|||||||
*/
|
*/
|
||||||
public static <T> List<List<T>> split(Collection<T> collection, int size) {
|
public static <T> List<List<T>> split(Collection<T> collection, int size) {
|
||||||
final List<List<T>> result = new ArrayList<>();
|
final List<List<T>> result = new ArrayList<>();
|
||||||
|
if (CollUtil.isEmpty(collection)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<T> subList = new ArrayList<>(size);
|
ArrayList<T> subList = new ArrayList<>(size);
|
||||||
for (T t : collection) {
|
for (T t : collection) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user