Here you can find the source of removeNulls(List
public static <T> List<T> removeNulls(List<T> list)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static <T> List<T> removeNulls(List<T> list) { final ArrayList<T> result = new ArrayList<>(list); result.removeAll(Collections.singleton(null)); return result; }//from ww w. j a v a 2 s. com }