Solve the first exercise
This commit is contained in:
parent
32799964b9
commit
29adffee18
1 changed files with 9 additions and 6 deletions
|
@ -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
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue