Вы сортируете, основываясь на том, какие команды бьют друг друга. Предположительно, вы хотите отсортировать по количеству баллов:
@Override
public int compareTo (Team team) {
if (team.getScoreDifference() > this.getScoreDifference()) {
return 1;
}
else if (team.getScoreDifference() < this.getScoreDifference()) {
return -1;
}
else {
return 0;
}
}
Пример вывода:
Leeds Rhinos 2 0 0 12 5 7
Sheffield 1 0 0 15 13 2
London 0 1 0 13 13 0
Burnley 0 1 0 10 10 0
Doncaster 0 0 1 12 20 -8
Southampton 0 0 1 10 20 -10
Вы можете переписать compareTo
гораздо проще:
@Override
public int compareTo(Team team) {
return Integer.compare(team.getScoreDifference(), this.getScoreDifference());
}