replaceWhere method
Replaces items from current list, checked by condition
and replaced by replace
.
Implementation
void replaceWhere(bool Function(T item) condition, T Function(T item) replace, {int count = -1}) {
var replaced = 0;
for (var i = 0; i < length; i++) {
if (condition(this[i])) {
this[i] = replace(this[i]);
replaced++;
if (count >= 1 && replaced >= count) {
return; // given count is valid && replaced count reaches limit
}
}
}
}