This commit is contained in:
Logen Kain 2021-04-16 09:55:59 -04:00
parent 5a080e088c
commit f7d7ce8447

View File

@ -30,8 +30,7 @@ public class CovidDatabase {
}
public ArrayList <CovidEntry> safeToOpen(String st){
ArrayList<CovidEntry> result = null;
ArrayList<CovidEntry> temp = new ArrayList<CovidEntry>();
ArrayList<CovidEntry> result = new ArrayList<CovidEntry>();
int match = 0;
int previousDailyInfections = -1;
@ -41,26 +40,21 @@ public class CovidDatabase {
previousDailyInfections = c.getDailyInfections();
match += 1;
}
else if (c.getDailyInfections() < previousDailyInfections) {
match += 1;
} else {
match = 1;
temp.clear();
result.clear();
}
temp.add(c);
result.add(c);
previousDailyInfections = c.getDailyInfections();
}
if (match == SAFE) {
result = temp;
break;
return result;
}
}
return result;
return null;
}
public ArrayList <CovidEntry>