CollectionUtil:判断集合不为空

public static boolean isNotEmpty(Object object) {
if(object instanceof List){
List list = (List)object; if(list != null && list.size() > 0){ return true; } else { return false; } } else if(object instanceof Map){ Map map = (Map)object;
if(map != null && map.size() > 0){
return true;
} else {
return false;
}
} else if(object instanceof Set){
Set<?> set = (Set) object;
if(set != null && set.size() > 0){
return true;
} else {
return false;
}
}else{
return false;
}
}

posted @ 2021-08-20 08:40  聖凯  阅读(512)  评论(0编辑  收藏  举报