// This will change the existing list
List<String> list = Arrays.asList("A", null, "B", null);
list.removeIf(Objects::isNull);
// This will return a new list without the null
List<String> list = Arrays.asList("A", null, "B", null);
List<String> newList = list.stream()
.filter(Objects::nonNull)
.collect(Collectors.toList());