From f8e60ce1cf1b1241c6d44f5dd84c204784157642 Mon Sep 17 00:00:00 2001 From: Michael Keppler Date: Sun, 17 Nov 2019 18:07:09 +0100 Subject: [PATCH] Simplify comparator code Use lambda style comparators where possible. They are easier to read. Change-Id: I5b80cfcd90909c94286742fa83af71015532809f Signed-off-by: Michael Keppler --- .../jgit/internal/storage/file/PackedBatchRefUpdate.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java index e45b53ea6..902357060 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java @@ -366,12 +366,8 @@ class PackedBatchRefUpdate extends BatchRefUpdate { List commands) throws IOException { // Construct a new RefList by merging the old list with the updates. // This assumes that each ref occurs at most once as a ReceiveCommand. - Collections.sort(commands, new Comparator() { - @Override - public int compare(ReceiveCommand a, ReceiveCommand b) { - return a.getRefName().compareTo(b.getRefName()); - } - }); + Collections.sort(commands, + Comparator.comparing(ReceiveCommand::getRefName)); int delta = 0; for (ReceiveCommand c : commands) {