Facebook
From xD, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 287
  1.     public int compareTo(Osoba other)
  2.     {
  3.         Student otherStudent = (Student) other;
  4.  
  5.         if ((getNazwisko().compareTo(otherStudent.getNazwisko()) == 0)) {
  6.             if ((getDataUrodzenia().compareTo(otherStudent.getDataUrodzenia()) == 0)) {
  7.                 if ((this.sredniaOcen == otherStudent.sredniaOcen)) {
  8.                 return 0;
  9.                 } else if(this.sredniaOcen < otherStudent.sredniaOcen) return -1;
  10.                 else return 1;
  11.             } else return getDataUrodzenia().compareTo(otherStudent.getDataUrodzenia());
  12.         } else return getNazwisko().compareTo(otherStudent.getNazwisko());
  13.     }