Browse Source

Simplify comparator code

Use lambda style comparators where possible. They are easier to read.

Change-Id: I5b80cfcd90909c94286742fa83af71015532809f
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
next
Michael Keppler 5 years ago
parent
commit
f8e60ce1cf
  1. 8
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java

8
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java

@ -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) {

Loading…
Cancel
Save