Use List.sort instead of Collections.sort
This commit is contained in:
@@ -604,7 +604,7 @@ public class CheckerTestUtil {
|
||||
diagnosticDescriptors.add(
|
||||
new DiagnosticDescriptor(range.getStartOffset(), range.getEndOffset(), diagnosticsGroupedByRanges.get(range)));
|
||||
}
|
||||
Collections.sort(diagnosticDescriptors, (d1, d2) -> {
|
||||
diagnosticDescriptors.sort((d1, d2) -> {
|
||||
// Start early -- go first; start at the same offset, the one who end later is the outer, i.e. goes first
|
||||
return (d1.start != d2.start) ? d1.start - d2.start : d2.end - d1.end;
|
||||
});
|
||||
|
||||
@@ -160,7 +160,8 @@ public class DiagnosticUtils {
|
||||
|
||||
@NotNull
|
||||
public static List<Diagnostic> sortedDiagnostics(@NotNull Collection<Diagnostic> diagnostics) {
|
||||
Comparator<Diagnostic> diagnosticComparator = (d1, d2) -> {
|
||||
List<Diagnostic> result = Lists.newArrayList(diagnostics);
|
||||
result.sort((d1, d2) -> {
|
||||
String path1 = d1.getPsiFile().getViewProvider().getVirtualFile().getPath();
|
||||
String path2 = d2.getPsiFile().getViewProvider().getVirtualFile().getPath();
|
||||
if (!path1.equals(path2)) return path1.compareTo(path2);
|
||||
@@ -173,9 +174,7 @@ public class DiagnosticUtils {
|
||||
}
|
||||
|
||||
return d1.getFactory().getName().compareTo(d2.getFactory().getName());
|
||||
};
|
||||
List<Diagnostic> result = Lists.newArrayList(diagnostics);
|
||||
Collections.sort(result, diagnosticComparator);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ public class ConstraintsUtil {
|
||||
interestingMethods.add(method);
|
||||
}
|
||||
}
|
||||
Collections.sort(interestingMethods, Comparator.comparing(Method::getName));
|
||||
interestingMethods.sort(Comparator.comparing(Method::getName));
|
||||
for (Iterator<Method> iterator = interestingMethods.iterator(); iterator.hasNext(); ) {
|
||||
Method method = iterator.next();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user