compareLists<T extends Comparable<T>> function

int compareLists<T extends Comparable<T>>(
  1. List<T> a,
  2. List<T> b
)

Implementation

int compareLists<T extends Comparable<T>>(List<T> a, List<T> b) {
  var aLength = a.length;
  var bLength = b.length;
  var minLength = aLength < bLength ? aLength : bLength;
  for (var i = 0; i < minLength; i++) {
    var result = a[i].compareTo(b[i]);
    if (result != 0) return result;
  }
  return aLength - bLength;
}