Here you can find the source of removeNull(Collection
public static <T> boolean removeNull(Collection<T> collection)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static <T> boolean removeNull(Collection<T> collection) { return collection.removeAll(Collections.singleton(null)); // jdk 8//from ww w. j a va2 s.c om // collection.parallelStream().filter(i -> i != null).collect(Collectors.toList()); // list.stream().filter(i -> i != null).collect(Collectors.toList()); // listWithoutNulls.removeIf(p -> p == null); } }