// Compares first by number and then by name. public int compareTo(Team other) { if (other == null) return -1; if (other.getNumber() != getNumber()) return getNumber() - other.getNumber(); return getName().compareTo(other.getName()); }
// Checks for equality with the specified team. private boolean equals(Team team) { return team.getName().equals(getName()) && team.getNumber() == getNumber(); }