package com.wqh.fsrm.common.util;
import java.util.*;
public class EmptyUtils {
/**
* 判断collection是否为空
* @param collection
* @return
*/
public static Boolean IsEmptyCollection(Collection collection){
if(null == collection || collection.isEmpty()){
return true;
}else{
return false;
}
}
/**
* 判断map 是否为空
* @param map
* @return
*/
public static Boolean IsEmptyMap(Map map){
if(null == map || map.isEmpty()){
return true;
}else{
return false;
}
}
/**
* 判断 list 是否为空
* @param list
*/
public static Boolean IsEmptyList(List list){
if(null == list || list.isEmpty()){
return true;
}else{
return false;
}
}
/**
* 判断set是否为空
* @param set
*/
public static Boolean IsEmptySet(Set set){
if(null == set || set.isEmpty()){
return true;
}else{
return false;
}
}
/**
* 判断字符串是否为空
* @param str
* @return
*/
public static Boolean isEmptyString(String str){
if(null == str || "".equals(str)){
return true;
}else{
return false;
}
}
public static void main(String[] args) {
Map<String,Object> map = new HashMap<>();
Boolean a = IsEmptyMap(map);
System.out.println(a);
}
}
06-16
1160
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-22
223
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交