In Java, remove empty elements from a list of Strings
arrays, java
Solution
List<String> list = new ArrayList<String>(Arrays.asList("", "Hi", null, "How"));
System.out.println(list);
list.removeAll(Arrays.asList("", null));
System.out.println(list);
Output:
[, Hi, null, How]
[Hi, How]
Problem
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 like this: ``` [Hi,How,are,you] ```