Just add as below
listnameObject.removeAll(Collections.singleton(null));
For Ex:
public class MapTest {
public static void main(String[] args) {
listnameObject.removeAll(Collections.singleton(null));
For Ex:
public class MapTest {
public static void main(String[] args) {
List<String> scores = new ArrayList<String>();
scores.add("100");
scores.add("90");
scores.add("80");
scores.add("97");
scores.add(null);
scores.removeAll(Collections.singleton(null));
for(String a : scores){
System.out.println(a.toString());
}
}
}
O/P:
100
90
80
97
No comments:
Post a Comment