1.输入
1 5
2 4
3 5
1 8
2 1
3 2
5 1
6 2
2.代码实现
2.1自定义比较器
import scala.math.Ordered;
import java.io.Serializable;
public class SecondarySortKey implements Ordered<SecondarySortKey>, Serializable {
int first;
int second;
public SecondarySortKey() {
}
public SecondarySortKey(int first, int second) {
this.first = first;
this.second = second;
}
public boolean $less(SecondarySortKey that) {
if (this.first < that.getFirst()) {
return true;
} else if (this.first == that.getFirst() && this.second < that.getSecond()) {
return true;
}
return false;
}
public boolean $greater(SecondarySortKey that) {
if (this.first > that.getFirst()) {
return <