]> source.dussan.org Git - jgit.git/commitdiff
Simplify comparator code 28/152828/1
authorMichael Keppler <Michael.Keppler@gmx.de>
Sun, 17 Nov 2019 17:07:09 +0000 (18:07 +0100)
committerMichael Keppler <Michael.Keppler@gmx.de>
Sun, 17 Nov 2019 17:07:09 +0000 (18:07 +0100)
Use lambda style comparators where possible. They are easier to read.

Change-Id: I5b80cfcd90909c94286742fa83af71015532809f
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java

index e45b53ea68051c889ab09d86327dc3d1e1732a90..9023570607d8b10529ecdb31fb991ce4a659701d 100644 (file)
@@ -366,12 +366,8 @@ class PackedBatchRefUpdate extends BatchRefUpdate {
                        List<ReceiveCommand> 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<ReceiveCommand>() {
-                       @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) {