other.latitude) {return ;} else {if (this.longitude return -;} else if (this.longitude > other.longitude) {return ;} else {return ;}}}}``````javaList coordinates = ... // 獲取坐標(biāo)列表Collections.sort(coordinates);```">

www.久久国产片_国产一区二区三区免费_野外各种姿势被np高h视频_无卡无码无免费毛片_国产精品无遮挡无打码黄污网

java 對坐標(biāo)排序

2024-02-15 17:11:56

```java

public class Coordinate implements Comparable {

private double latitude;

private double longitude;

public int compareTo(Coordinate other) {

if (this.latitude < other.latitude) {

return -;

} else if (this.latitude > other.latitude) {

return ;

} else {

if (this.longitude < other.longitude) {

return -;

} else if (this.longitude > other.longitude) {

return ;

} else {

return ;

}

}

}

}

```

```java

List coordinates = ... // 獲取坐標(biāo)列表

Collections.sort(coordinates);

```