Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Comparator<Person> comp = new Comparator<Person>() {
- // Opgave 1B:
- // Comparatoren skal sorterer på heigth
- @Override
- public int compare(Person o1, Person o2) {
- double heigth1 = o1.heigth;
- double heigth2 = o2.heigth;
- if (heigth1 < heigth2) {
- return -1;
- } else if (heigth1 == heigth2) {
- return 0;
- } else {
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement