1 Arrays.sort(points, new comparator());
2
3 public static class comparator implements Comparator<Point> {
4 public int compare(Point p1, Point p2) {
5 return p1.x - p2.x;
6 }
Java Comparator,布布扣,bubuko.com
时间: 2024-12-05 08:20:05
1 Arrays.sort(points, new comparator());
2
3 public static class comparator implements Comparator<Point> {
4 public int compare(Point p1, Point p2) {
5 return p1.x - p2.x;
6 }
Java Comparator,布布扣,bubuko.com