
com.hecloud.runtime.common.collections.Lists Maven / Gradle / Ivy
package com.hecloud.runtime.common.collections;
import java.util.ArrayList;
import java.util.List;
/**
* List工具
*
* @author LoveinBJ
*/
public class Lists {
/**
* 判断当前List是否为空
*
* @param list 数组
* @return 是否为空
*/
public static boolean isEmpty(List> list) {
return null == list || list.isEmpty();
}
public static ArrayList> newArrayList() {
return new ArrayList<>();
}
/**
* 判断当前list是否为空,以及list里面的所有元素是否都为空
*
* @param list 数组
* @return 是否全为null
*/
public static boolean allNull(List> list) {
if (isEmpty(list)) {
return true;
}
return list.stream().allMatch(data -> null == data);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy