partitionInPlace method
Reorders the elements of this iterator in-place according to the given predicate, such that all those that return true precede all those that return false. Returns the number of true elements found. The relative order of partitioned items is not maintained.
Implementation
@override
int partitionInPlace(bool Function(T) f) {
final list = toList(growable: false);
var i = 0;
var j = list.length - 1;
while (i < j) {
if (f(list[i])) {
i++;
} else {
final temp = list[i];
list[i] = list[j];
list[j] = temp;
j--;
}
}
_wIterator = list.iterator;
return i;
}