import java.util.*; public class PairComp implements Comparable> { T1 first; T2 second; PairComp(T1 first, T2 second){ this.first = first; this.second = second; } T1 getFirst(){ return this.first; } T2 getSecond(){ return this.second; } @Override public int compareTo(PairComp other){ if (this.getFirst().doubleValue() < other.getFirst().doubleValue()){ return -1; } if (this.getFirst().doubleValue() > other.getFirst().doubleValue()){ return 1; } return 0; } }