package brilliance.znjt.serviceratingservice.utils;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class xx {
/**
* 对象是否为空
* @param obj String,List,Map,Object[],int[],long[]
* @return
*/
@SuppressWarnings("rawtypes")
public static boolean isEmpty(Object o) {
if (o == null) {
return true;
}
if (o instanceof String) {
if (o.toString().trim().equals("")||o.toString().trim().equals("null")) {
return true;
}
} else if (o instanceof List) {
if (((List) o).size() == 0) {
return true;
}
} else if (o instanceof Map) {
if (((Map) o).size() == 0) {
return true;
}
} else if (o instanceof Set) {
if (((Set) o).size() == 0) {
return true;
}
} else if (o instanceof Object[]) {
if (((Object[]) o).length == 0) {
return true;
}
} else if (o instanceof int[]) {
if (((int[]) o).length == 0) {
return true;
}
} else if (o instanceof long[]) {
if (((long[]) o).length == 0) {
return true;
}
} else if(o instanceof Integer) {
if (o.toString().trim().equals("0")) {
return true;
}
}
return false;
}
/**
* 对象组中是否存在 Empty Object
* @para
java判断是否为空工具类判断为空
最新推荐文章于 2024-05-14 09:16:45 发布