This method is used to compare the names of two candidates. Returns 0 if the name of this candidate is the same as the name of otherCan; returns < 0 if the name of this candidate is less then the name of otherCan; returns > 0 if the name of this candidate is greater than the name of otherCan.
@Override
public int compareTo(Candidate otherCan) {
if(name = otherCan){
return this.name.compareToIgnoreCase(otherCan.getName());
} else if(name < otherCan){
return name < 0
} else if(name > otherCan){
return name > 0
}
}
How do I compare them and what does return > 0 and < 0 mean?