Java开发中判断集合类为空的方法

来源:互联网 发布:电力网络 编辑:程序博客网 时间:2024/05/18 02:52

*****需要引入Spring的核心Jar包*****

工具类:  

    org.springframework.util.CollectionUtils


方法:

public static boolean isEmpty(Collection collection)
{
return collection == null || collection.isEmpty();
}

 

public static boolean isEmpty(Map map)
{
return map == null || map.isEmpty();
}


0 0
原创粉丝点击