📜  如何使用集合计算空值 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:49.638000             🧑  作者: Mango

代码示例1
HOW TO COUNT NULL VALUES
List list = new ArrayList(Arrays.asList
                              ("Java",null,"Python",null, "Ruby"));
CollectionUtils.filter(list, PredicateUtils
                           .nullPredicate()); ==> keeps only nulls
System.out.println(list.size());