static bool isSortedListByComparator(Cl l, Comparator cmp) { Iterator it = iterator(l); if (!it.hasNext()) true; A a = it.next(); while (it.hasNext()) { A b = it.next(); if (cmp.compare(a, b) > 0) false; a = b; } true; }