<分区>
在 google Guava 中是否有任何等价于 apache commons' CollectionUtils.isEmpty(list)
的东西?检查集合是否为 null 或空?
<分区>
在 google Guava 中是否有任何等价于 apache commons' CollectionUtils.isEmpty(list)
的东西?检查集合是否为 null 或空?
最佳答案
要检查Collection
是否均为null 和空,您必须自己进行null 检查。 Guava 开发者提倡完全不要将 null
用于 Collection
- 请参阅 IdeaGraveyard在 Guava 维基上:
Prefer to return empty collections instead of null. Then a plain isEmpty check will suffice.
编辑:
关于java - Guava 中有 Empty 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16956522/