Solve the first exercise

This commit is contained in:
Manuel Thalmann 2022-10-04 14:36:37 +02:00
parent 32799964b9
commit 29adffee18

View file

@ -48,20 +48,23 @@ public class Competitor implements Comparable<Competitor> {
@Override
public int compareTo(Competitor o) {
// TODO Implement
return 0;
return Long.compare(parseTime(getTime()), parseTime(o.getTime()));
}
@Override
public boolean equals (Object o) {
// TODO Implement
return false;
if (o instanceof Competitor) {
Competitor c = (Competitor)o;
return compareTo(c) == 0;
}
else {
return false;
}
}
@Override
public int hashCode() {
// TODO Implement
return 0;
return (getTime().hashCode() + getName().hashCode()) * rank;
}
}