I have an arrayList of Objects, and each object has a list of string members.
I'm trying to iterate through the list and remove any member of the list that has a specific element (status) that is null.
the objects elements are set to null in their constructor, and remain null if they are not filled in. I can't understand why I'm getting an NPE. I've debugged it and i can step through the loop and see each element and their members, but once i hit an element who's member "status" is null, I'm getting an NPE.
Any help appreciated.
public ArrayList<FlightObject> processResults(ArrayList<FlightObject> list) {
for (int i = 0; i< list.size(); i++) {
if (list.get(i).status.toString() == null) {
list.remove(i);
}
}
return list;
}