Here you can find the source of removeNull(T[] data)
private static <T> T[] removeNull(T[] data)
//package com.java2s; //License from project: Creative Commons License import java.util.ArrayList; public class Main { private static <T> T[] removeNull(T[] data) { ArrayList<T> temp = new ArrayList(); for (T f : data) if (f != null) temp.add(f);//from w w w .java 2s . c o m return temp.toArray(data); } }