Fix .compareTo() calculation in Size and Weight classes.
[Persons_Comparator.git] / src / Weight.java
index 47547ba4f524711c42a3bc1c3e561fec0be48853..5e33327fac7ec77eac23a14ec0aa46a6b4e65342 100644 (file)
@@ -26,7 +26,7 @@ public class Weight implements Comparable<Weight> {
 
     @Override
     public int compareTo(Weight weight) {
-        int distance = weight.weight - this.getWeight();
+        int distance = weight.getWeight() - this.getWeight();
         if (distance >= 0)
             return distance;
         else