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>
This commit is contained in:
parent
8fcba48b72
commit
f8e60ce1cf
|
@ -366,12 +366,8 @@ private static RefList<Ref> applyUpdates(RevWalk walk, RefList<Ref> refs,
|
||||||
List<ReceiveCommand> commands) throws IOException {
|
List<ReceiveCommand> commands) throws IOException {
|
||||||
// Construct a new RefList by merging the old list with the updates.
|
// Construct a new RefList by merging the old list with the updates.
|
||||||
// This assumes that each ref occurs at most once as a ReceiveCommand.
|
// This assumes that each ref occurs at most once as a ReceiveCommand.
|
||||||
Collections.sort(commands, new Comparator<ReceiveCommand>() {
|
Collections.sort(commands,
|
||||||
@Override
|
Comparator.comparing(ReceiveCommand::getRefName));
|
||||||
public int compare(ReceiveCommand a, ReceiveCommand b) {
|
|
||||||
return a.getRefName().compareTo(b.getRefName());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
int delta = 0;
|
int delta = 0;
|
||||||
for (ReceiveCommand c : commands) {
|
for (ReceiveCommand c : commands) {
|
||||||
|
|
Loading…
Reference in New Issue