solved Task 1

This commit is contained in:
schrom01 2022-10-04 12:54:21 +02:00
parent 52b3facf00
commit 5e94dc5f40
1 changed files with 8 additions and 2 deletions

View File

@ -49,19 +49,25 @@ public class Competitor implements Comparable<Competitor> {
@Override @Override
public int compareTo(Competitor o) { public int compareTo(Competitor o) {
// TODO Implement // TODO Implement
return 0; Competitor o2 = (Competitor)o;
return (int) (this.parseTime(time) - o.parseTime(o2.getTime()));
} }
@Override @Override
public boolean equals (Object o) { public boolean equals (Object o) {
// TODO Implement // TODO Implement
if(o instanceof Competitor){
Competitor o2 = (Competitor)o;
return compareTo(o2) == 0;
}
return false; return false;
} }
@Override @Override
public int hashCode() { public int hashCode() {
// TODO Implement // TODO Implement
return 0; int result = 17;
return result * (int)parseTime(time);
} }
} }