Implement a comparator for sorting names alphabetically

This commit is contained in:
Manuel Thalmann 2022-10-04 21:32:37 +02:00
parent 72b926a0a8
commit 73374ed7bb

View file

@ -24,6 +24,10 @@ public class Competitor implements Comparable<Competitor> {
return time; return time;
} }
public Long getTimeValue() {
return parseTime(getTime());
}
public String getName() { public String getName() {
return name; return name;
} }
@ -83,8 +87,13 @@ class AlphaComparatorCompetitor implements Comparator<Competitor> {
@Override @Override
public int compare(Competitor o1, Competitor o2) { public int compare(Competitor o1, Competitor o2) {
// TODO Implement int result = o1.getName().compareTo(o2.getName());
int c = 0;
return c; if (result == 0) {
return Long.compare(o1.getTimeValue(), o2.getTimeValue());
}
else {
return result;
}
} }
} }