This simple piece of code removes any Statistic in an arrayList if its properties are null. Unfortunately, I'm getting a java.lang.NullPointerException on the first line of the if Statement (if tempStat.serialName==null...). Thoughts?
public static ArrayList<Statistic> removeEmptyStats(ArrayList<Statistic> al) {
Statistic tempStat=new Statistic();
for (int i=0; i<al.size(); i++) {
tempStat=al.get(i);
if (tempStat.serialName==null || tempStat.serialPublisher==null || tempStat.serialISSN==null || tempStat.serialOnlineISSN==null) {
al.remove(i);
}
}
return al;
}
tempStatisnullthen