code: public static <U> int canonicalCompare(List<? extends U> o1,
                                             List<? extends U> o2,
                                             Comparator<? super U> elemComparator) {
          int siz1 = o1.size(), siz2 = o2.size();
  
          if (siz1 != siz2) {
              return siz1 - siz2;
          }
  
          return lexCompare(o1, o2, elemComparator);
      }
docs: Compares two {@link List}s with respect to canonical ordering.
  <p>
  In canonical ordering, a sequence {@code o1} is less than a sequence {@code o2} if {@code o1} is shorter than
  {@code o2}, or if they have the same length and {@code o1} is lexicographically smaller than {@code o2}.
  
  @param o1
  the first list
  @param o2
  the second list
  @param elemComparator
  the comparator for comparing the single elements
  
  @return the result of the comparison