In Learn -> Lambda Expressions -> Writing and Combining Comparators, in the section "Chaining Comparators" may I suggest a change to the code to make sorting by first name and last name more realistic?
Sorting of names is typically done by last name first and then first name after, rather than the other way around. So instead of what currently exists in the tutorial:
Comparator<User> byFirstNameThenLastName = byFirstName.thenComparing(byLastName);
... you will have:
Comparator<User> byLastNameThenFirstName = byLastName.thenComparing(byFirstName);
If the code that I suggest is changed and implemented in a program you will have realistically sorted names. As it is, the lesson still stands but it can be confusing to a beginner because the names will not actually be sorted correctly and it could seem like a programming error rather than a logical error.
This change would also require updating other code parts and text parts in this section.
In Learn -> Lambda Expressions -> Writing and Combining Comparators, in the section "Chaining Comparators" may I suggest a change to the code to make sorting by first name and last name more realistic?
Sorting of names is typically done by last name first and then first name after, rather than the other way around. So instead of what currently exists in the tutorial:
Comparator<User> byFirstNameThenLastName = byFirstName.thenComparing(byLastName);... you will have:
Comparator<User> byLastNameThenFirstName = byLastName.thenComparing(byFirstName);If the code that I suggest is changed and implemented in a program you will have realistically sorted names. As it is, the lesson still stands but it can be confusing to a beginner because the names will not actually be sorted correctly and it could seem like a programming error rather than a logical error.
This change would also require updating other code parts and text parts in this section.