Here you can find the source of removeEmptyStringsInArray(String[] array)
public static List<String> removeEmptyStringsInArray(String[] array)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Main { public static List<String> removeEmptyStringsInArray(String[] array) { List<String> list = Arrays.asList(array); return removeEmptyStringsInList(list); }//from w w w . ja v a 2 s .c o m public static List<String> removeEmptyStringsInList(List<String> list) { List<String> newList = new ArrayList<String>(); for (String s : list) { if (!s.isEmpty()) { newList.add(s.trim()); } } return newList; } }