[vcs-log] use Comparator.reverseOrder and Comparator.comparingInt methods

This commit is contained in:
Julia Beliaeva
2017-07-30 15:52:23 +03:00
parent b317f6d018
commit 3a55f07fb4
2 changed files with 3 additions and 6 deletions
@@ -25,10 +25,7 @@ import com.intellij.vcs.log.graph.utils.impl.BitSetFlags;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import static com.intellij.vcs.log.graph.impl.permanent.DuplicateParentFixer.fixDuplicateParentCommits;
@@ -155,7 +152,7 @@ public class PermanentLinearGraphBuilder<CommitId> {
private void fixUnderdoneEdges(@NotNull NotNullFunction<CommitId, Integer> notLoadedCommitToId) {
List<CommitId> commitIds = ContainerUtil.newArrayList(upAdjacentNodes.keySet());
ContainerUtil.sort(commitIds, (o1, o2) -> Collections.min(upAdjacentNodes.get(o1)) - Collections.min(upAdjacentNodes.get(o2)));
ContainerUtil.sort(commitIds, Comparator.comparingInt(o -> Collections.min(upAdjacentNodes.get(o))));
for (CommitId notLoadCommit : commitIds) {
int notLoadId = notLoadedCommitToId.fun(notLoadCommit);
for (int upNodeIndex : upAdjacentNodes.get(notLoadCommit)) {
@@ -169,7 +169,7 @@ public class LinearBekController extends CascadeController {
}
private SortedSet<Integer> collectNodesToCollapse(GraphNode node) {
SortedSet<Integer> toCollapse = new TreeSet<>((o1, o2) -> o2.compareTo(o1));
SortedSet<Integer> toCollapse = new TreeSet<>(Comparator.reverseOrder());
for (LinearBekGraphBuilder.MergeFragment f : collectFragmentsToCollapse(node)) {
toCollapse.add(f.getParent());
toCollapse.addAll(f.getTailsAndBody());