blob: 3f9f0ad7eb0df6843cf4a645449c9c9acb945451 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package test;
public class IntDoublePair implements Comparable{
double val;
int idx;
public int compareTo(Object o){
if(o instanceof IntDoublePair){
IntDoublePair pair=(IntDoublePair)o;
if(pair.val>val){
return 1;
}
if(pair.val<val){
return -1;
}
return 0;
}
return -1;
}
public IntDoublePair(int i,double v){
val=v;
idx=i;
}
}
|