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