cmpBy<U> method
Lexicographically compares the elements of this Iterator with those of another with respect to the specified comparison function. Less = -1 Equal = 0 Greater = 1
Implementation
@override
int cmpBy<U>(Iterator<U> other, int Function(T, U) f) {
while (true) {
if (moveNext()) {
if (other.moveNext()) {
final cmp = f(current, other.current);
if (cmp != 0) {
return cmp;
}
} else {
return 1;
}
} else {
if (other.moveNext()) {
return -1;
}
return 0;
}
}
}