Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/useCompareMethod/beforeCompareTwoFields.java
Tagir Valeev 05309a5d4e [java-inspections] IDEA-273527 Incorrect generated code with "Can be replaced with 'Integer.compare'"
GitOrigin-RevId: 4918eebd8b1d6996a8330bf4cbfcc66a367ded18
2021-07-14 16:12:20 +00:00

21 lines
637 B
Java

// "Fix all ''compare()' method can be used to compare numbers' problems in file" "false"
import java.util.ArrayList;
import java.util.List;
public class Sort {
static class Point {
int x, y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
@Override
public String toString() {
return "(" + x + ", " + y + ")";
}
}
public static void main(String[] args) {
List<Point> l = Arrays.asList(new Point(1, 0), new Point(0, 1), new Point(0, 0)));
l.sort((o1, o2) -> <caret>o1.x < o2.x ? -1 : o1.x > o2.x ? 1 : o1.y < o2.y ? -1 : o1.y > o2.y ? 1 : 0);
System.out.println(l);
}
}