My problem is that a collection has a null value, and any "utils" method return that the collection is not empty. There are other "elegant" options?
This code throws a null pointer exception:
public static void main(String[] args) { ArrayList<String> strings = new ArrayList<>(); strings.add(null); if(CollectionUtils.isNotEmpty(strings)) { for (String s : strings) { System.out.println(s.length()); } } }