Implement eye color compareTo() method.
[Persons_Comparator.git] / src / Size.java
index a526fab6a01a3fb9ce5d5ce31b5f39aef3d3bae2..c2392073b34662affdc474f619a1ab27519e2a98 100644 (file)
@@ -1,5 +1,3 @@
-import java.util.Comparator;
-
 public class Size implements Comparable<Size> {
     private int max = 240;
     private int min = 20;
@@ -27,6 +25,11 @@ public class Size implements Comparable<Size> {
 
     @Override
     public int compareTo(Size size) {
-        return 0;
+        int distance = size.size - this.getSize();
+        if (distance >= 0)
+            return distance;
+        else
+            return -distance;
+
     }
 }