diff --git a/src/ch/zhaw/ads/MyCompetitor.java b/src/ch/zhaw/ads/MyCompetitor.java index 0e14684..36170c9 100644 --- a/src/ch/zhaw/ads/MyCompetitor.java +++ b/src/ch/zhaw/ads/MyCompetitor.java @@ -48,18 +48,23 @@ public class MyCompetitor implements Comparable { @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 - return false; + if(! (o instanceof MyCompetitor)){ + return false; + } + return compareTo((MyCompetitor) o) == 0; } }