雕刻时光

just do it……nothing impossible
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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

Posted on 2019-04-04 16:55  huhuuu  阅读(5267)  评论(0编辑  收藏  举报

避免写两个判断

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();
}
---------------------
原文:https://blog.csdn.net/sinosoft12345/article/details/54614005