resizeAndGenerate method
Resizes the list by resizeBy
, setting the new elements with the
generator
if resizeBy
is positive, otherwise removing elements
if resizeBy
is negative.
Implementation
void resizeAndGenerate(int resizeBy, ListGenerator<T> generator) {
if (resizeBy.isNegative) {
removeFromEnd(-resizeBy);
} else {
addAll(List<T>.generate(resizeBy, generator));
}
}