public class Weight implements Comparable<Weight> {
private int weight;
+ Weight() {
+ }
+
Weight(int weight) {
setWeight(weight);
}
@Override
public int compareTo(Weight weight) {
- return 0;
+ int distance = weight.getWeight() - this.getWeight();
+ if (distance >= 0)
+ return distance;
+ else
+ return -distance;
}
}