I wish to compare two Die object by "int value" , and return the object with the higher value. What am I doing wrong ... Thanks
public class Die implements DieIntf , Comparable {
private int value;
public Die(){}
class ComparatorId implements Comparator<Die> {
@Override
public int compare(Die t, Die t1) {
Integer d1 = t.getValue();
Integer d2 = t.getValue();
if(d1>d2) return 1;
else if(d1<d2) return -1;
else return 0;
}
}
}