public int compareSwappedTo(IntDoublePair other){
  int fdiff=Double.compare(this.second,other.second);
  if (fdiff != 0) {
    return fdiff;
  }
  return this.first - other.first;
}

public int compareSwappedTo ( IntDoublePair other ) { int fdiff = Double . compare ( this . second , other . second ) ; if ( fdiff != 0 ) { return fdiff ; } return this . first - other . first ; }
implementation of comparableswapped interface , sorting by second then first .
