diff --git a/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/GcEvent.java b/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/GcEvent.java index 4010d7f24..e2c5ea87c 100644 --- a/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/GcEvent.java +++ b/spectator-ext-gc/src/main/java/com/netflix/spectator/gc/GcEvent.java @@ -109,10 +109,8 @@ public String toString() { } /** Order events from oldest to newest. */ - public static final Comparator TIME_ORDER = - (e1, e2) -> (int) (e1.getStartTime() - e2.getStartTime()); + public static final Comparator TIME_ORDER = Comparator.comparing(GcEvent::getStartTime); /** Order events from newest to oldest. */ - public static final Comparator REVERSE_TIME_ORDER = - (e1, e2) -> (int) (e2.getStartTime() - e1.getStartTime()); + public static final Comparator REVERSE_TIME_ORDER = TIME_ORDER.reversed(); }