/**
* 判断对象是否Empty(null或元素为0)<br>
* 实用于对如下对象做判断:String Collection及其子类 Map及其子类
*
* @param pObj
* 待检查对象
* @return boolean 返回的布尔值
*/
public static boolean isEmpty(Object pObj) {
boolean isEmpty = false;
if (pObj == null) {
isEmpty = true;
} else {
if (pObj instanceof String) {
isEmpty = StringUtils.isBlank((String) pObj);
} else if (pObj instanceof Collection) {
isEmpty = CollectionUtils.isEmpty((Collection<?>) pObj);
} else if (pObj instanceof HashMap) {
isEmpty = MapUtils.isEmpty((HashMap<?, ?>) pObj);
}
}
return isEmpty;
}
java 对象判断是否为空
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiaoyanli8077/article/details/88286282
猜你喜欢
转载自blog.csdn.net/xiaoyanli8077/article/details/88286282
今日推荐
周排行