@Override public int compareTo(DoubleIntPair other){
  int fdiff=Double.compare(this.first,other.first);
  if (fdiff != 0) {
    return fdiff;
  }
  return this.second - other.second;
}

@ Override public int compareTo ( DoubleIntPair other ) { int fdiff = Double . compare ( this . first , other . first ) ; if ( fdiff != 0 ) { return fdiff ; } return this . second - other . second ; }
implementation of comparable interface , sorting by first then second .
