static int compareWithComparator(Comparator comparator, A a, A b) { ret comparator == null ? cmp(a, b) : comparator.compare(a, b); }