CollectionUtils { static <T> boolean containsNullElements(@Nullable Collection<T> data) { if (data == null) { return true; } for (T datum : data) { if (datum == null) { return true; } } return false; }    }
@Test public void nullInput() { assertTrue(CollectionUtils.containsNullElements(null)); }
@Test public void sanitiseSet() { Set<String> input = new HashSet<>(); input.add("foo"); assertFalse(CollectionUtils.containsNullElements(input)); input.add(null); assertTrue(CollectionUtils.containsNullElements(input)); }