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
Its a very late answer, but you can also use the Collections.singleton:
Collections.singleton
List list = new ArrayList(Arrays.asList("", "Hi", null, "How")); list.removeAll(Collections.singleton(null)); list.removeAll(Collections.singleton(""));