X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FWeight.java;h=e79d1025a9e35977344ab5003e129df1aa88ff03;hb=0fc8383b05684d5d760a2ba82ab33479dbdd5103;hp=b0264faa591187841e4345f0a94b00e0d9347f63;hpb=1c1189337121a1baa74961813e619c99b398a333;p=Persons_Comparator.git diff --git a/src/Weight.java b/src/Weight.java index b0264fa..e79d102 100644 --- a/src/Weight.java +++ b/src/Weight.java @@ -23,6 +23,10 @@ public class Weight implements Comparable { @Override public int compareTo(Weight weight) { - return 0; + int distance = weight.weight - this.getWeight(); + if (distance >= 0) + return distance; + else + return -distance; } }