We have an array list which holds TestVo objects. TestVo object have "blockNo, buildingName, etc" variables with getter and setters. We are setting the values and adding that object to the list. Now we need to remove the object contains null value from the list. Sample Code:
List <TestVo> listOfBranches = new ArrayList<TestVo>(); TestVo obj1 = new TestVo(); obj1.setBlockNo("1-23"); obj1.setBuildingName(null); TestVo obj2 = new TestVo(); obj2.setBlockNo(null); obj2.setBuildingName("test"); TestVo obj3 = new TestVo(); obj3.setBlockNo("4-56"); obj3.setBuildingName("test, Ind"); listOfBranches.add(obj1); listOfBranches.add(obj2); listOfBranches.add(obj3); So finally how can we remove the object contains null value from the list.