Java tutorial
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { /** * * @param <T> * @param list */ public static <T> void filterNulls(List<T> list) { if (null == list || list.isEmpty()) return; for (int i = 0; i < list.size(); i++) { T current = list.get(i); if (null == current) { list.remove(i); } } } }