Removing null or specific values from list in Java
Have you tried to remove null  values from a List (may a ArrayList). Yesterday I was trying it out, when I had to remove null  values from a List before processing it.     Initially, I was trying with the simple  for loop and out I was getting Still NullPointerException while processing. I tried with couple of ways, before I came to a efficient one. Lets see this with an example:      Lets see what are the flaws, when u try to remove null values from a List with a for loop:      List li = new ArrayList();   FileListItem fLI = new FileListItem();   fLI.setFormFileName("123");   FileListItem fLI2 = new FileListItem();   FileListItem fLI3 = new FileListItem();   FileListItem fLI4 = new FileListItem();   fLI4.setFormFileName("456");   li.add(fLI);   li.add(fLI2);   li.add(fLI3);   li.add(fLI4);                 System.out.println("====this.fileList() =====" + li);   for(int i = 0;i   System.out.println("li Size ====" + li.size() + "      & Va...