RFR: 8274319: Replace usages of Collections.sort with List.sort call in jdk.jfr [v2]

Erik Gahlin egahlin at openjdk.java.net
Fri Oct 8 20:42:07 UTC 2021


On Fri, 8 Oct 2021 20:14:32 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:

>> Collections.sort is just a wrapper, so it is better to use an instance method directly.
>> 
>> Also Comparator's implementation can be cleaned up with help of static methods in `Comparator` class.
>> E.g.
>> 
>>         Collections.sort(sorted, new Comparator<EventType>() {
>>             @Override
>>             public int compare(EventType e1, EventType e2) {
>>                 return e1.getName().compareTo(e2.getName());
>>             }
>>         });
>> 
>> can be replaced with
>> 
>> sorted.sort(Comparator.comparing(EventType::getName));
>
> Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8274319: Replace usages of Collections.sort with List.sort call in jdk.jfr
>   fix post-review comments

Marked as reviewed by egahlin (Reviewer).

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

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


More information about the hotspot-jfr-dev mailing list