-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
8u40
-
x86_64
-
linux
A DESCRIPTION OF THE REQUEST :
Enhancement Proposal:
With Java 8's API change, Collections#sort(List, Comparator) can now be rewritten as List#sort(Comparator), but Collections#sort(List), which sorts the list according to the elements' natural ordering, must be written this way as well, with "null" passed in as the comparator argument. This proposal suggests creating a zero-argument overload, List#sort(), for the latter case, so that a null literal does not have to be passed in for this common case.
JUSTIFICATION :
Sorting a list of elements by their natural order is a common case (perhaps the most common). Requiring the user to pass in a null argument for in this case seems unnatural.
Enhancement Proposal:
With Java 8's API change, Collections#sort(List, Comparator) can now be rewritten as List#sort(Comparator), but Collections#sort(List), which sorts the list according to the elements' natural ordering, must be written this way as well, with "null" passed in as the comparator argument. This proposal suggests creating a zero-argument overload, List#sort(), for the latter case, so that a null literal does not have to be passed in for this common case.
JUSTIFICATION :
Sorting a list of elements by their natural order is a common case (perhaps the most common). Requiring the user to pass in a null argument for in this case seems unnatural.