Partytiger
Grünschnabel
hmm meinst du so ungefähr:
public int compareTo(Object o) {
Student student2 = (Student) o;
if (this.getMatrikelnr().compareTo(student2.getMatrikelnr()) > 0) {
return 1;
} else if (this.getMatrikelnr().compareTo(student2.getMatrikelnr()) < 0) {
return -1;
}
return 0;
}
private String getMatrikelnr() {
return matrikelnr;
}
public int compareTo(Object o) {
Student student2 = (Student) o;
if (this.getMatrikelnr().compareTo(student2.getMatrikelnr()) > 0) {
return 1;
} else if (this.getMatrikelnr().compareTo(student2.getMatrikelnr()) < 0) {
return -1;
}
return 0;
}
private String getMatrikelnr() {
return matrikelnr;
}