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

liach github.com+7806504+liach at openjdk.java.net
Mon Sep 13 22:14:18 UTC 2021


On Mon, 13 Sep 2021 17:56:14 GMT, Rémi Forax <forax at openjdk.org> wrote:

>> Collections.sort is just a wrapper, so it is better to use an instance method directly.
>
> 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?

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

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


More information about the javadoc-dev mailing list