package ru.job4j.comparator;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * Class ListCompare.
 * @author Tatyana Fukova (mailto:tatyanafukova@gmail.com)
 * @version $I$
 * @since 18.01
 */
public class ListCompare implements Comparator<List<Integer>> {
    /**
     * Method to compare two lists.
     * @param left, right  two given lists.
     * @return result.
     */
    @Override
    public int compare(List<Integer> left, List<Integer> right) {

        Collections.sort(left);
        Collections.sort(right);

        int maxLenght = 0;
        if (left.size() <= right.size()) {
            maxLenght = left.size();
        } else {
            maxLenght = right.size();
        }

        for (int i = 0; i < maxLenght; i++) {
            if (left.get(i).compareTo(right.get(i)) == 0) {
                continue;
            } else {
                return left.get(i).compareTo(right.get(i));
            }
        }
        int diff = left.size() - right.size();
        if (diff < 0) {
            return -1;
        } else if (diff > 0) {
            return 1;
        }
        return 0;
    }
}
@@ -730,16 +730,40 @@
      %7D%0A%0A
+        int result = 0;%0A
         
@@ -925,20 +925,22 @@
       re
-turn
+sult =
  left.ge
@@ -1058,16 +1058,31 @@
  (diff %3C
+ 0 && result ==
  0) %7B%0A  
@@ -1093,20 +1093,22 @@
       re
-turn
+sult =
  -1;%0A   
@@ -1129,16 +1129,31 @@
  (diff %3E
+ 0 && result ==
  0) %7B%0A  
@@ -1164,20 +1164,22 @@
       re
-turn
+sult =
  1;%0A    
@@ -1199,17 +1199,22 @@
  return 
-0
+result
 ;%0A    %7D%0A

Compare two lists