solved Task 2
This commit is contained in:
parent
69fb83dd74
commit
15e14023db
|
@ -48,18 +48,23 @@ public class MyCompetitor implements Comparable<MyCompetitor> {
|
|||
@Override
|
||||
public int compareTo(MyCompetitor o) {
|
||||
// to be done
|
||||
return -1;
|
||||
int rankDiff = rank - o.rank;
|
||||
int nameDiff = name.compareTo(o.name);
|
||||
return 10000 * rankDiff + nameDiff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// to be done
|
||||
return -1;
|
||||
return rank % 3500 + name.hashCode() ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals (Object o) {
|
||||
// to be done
|
||||
if(! (o instanceof MyCompetitor)){
|
||||
return false;
|
||||
}
|
||||
return compareTo((MyCompetitor) o) == 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue