In Java, I have an ArrayList of Strings like:
[,Hi, ,How,are,you]
I want to remove the null and empty elements, how to change it so it is l
private List cleanInputs(String[] inputArray) { List result = new ArrayList(inputArray.length); for (String input : inputArray) { if (input != null) { String str = input.trim(); if (!str.isEmpty()) { result.add(str); } } } return result; }