RFR: 8272992: Replace usages of Collections.sort with List.sort call in jdk.* modules [v2]

Andrey Turbanov github.com+741251+turbanoff at openjdk.java.net
Tue Sep 14 07:46:13 UTC 2021


On Mon, 13 Sep 2021 22:11:24 GMT, liach <github.com+7806504+liach at openjdk.org> wrote:

>> src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java line 215:
>> 
>>> 213:                 pathLookup.remove(remove);
>>> 214:             }
>>> 215:             added.sort((p1, p2) -> p1.compareTo(p2));
>> 
>> 'added.sort(Path::compareTo)'
>
> Can't we just use natural ordering `null` here?

Replaced with `Collections.sort` without comparator argument. I think it's a bit easier to read than with `null`.
https://github.com/openjdk/jdk/pull/5229#discussion_r695525255

-------------

PR: https://git.openjdk.java.net/jdk/pull/5230


More information about the serviceability-dev mailing list