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

Andrey Turbanov github.com+741251+turbanoff at openjdk.java.net
Fri Oct 8 20:14:32 UTC 2021


> 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

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/5696/files
  - new: https://git.openjdk.java.net/jdk/pull/5696/files/1f2de662..0003b0e2

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5696&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5696&range=00-01

  Stats: 3 lines in 2 files changed: 0 ins; 1 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5696.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5696/head:pull/5696

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


More information about the hotspot-jfr-dev mailing list