Refactor
This commit is contained in:
parent
5a080e088c
commit
f7d7ce8447
@ -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 null;
|
||||
}
|
||||
|
||||
public ArrayList <CovidEntry>
|
||||
|
Loading…
x
Reference in New Issue
Block a user