CollectionUtil:判断集合不为空

时间:2021-08-20 09:29:54   收藏:0   阅读:20

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;
}
}

原文:https://www.cnblogs.com/dhc1995/p/15164856.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!