resizeAndFill method
Resizes the list by resizeBy
, setting the new elements to fill
if resizeBy
is positive, otherwise removing elements if resizeBy
is negative.
Implementation
void resizeAndFill(int resizeBy, T fill) {
if (resizeBy.isNegative) {
removeFromEnd(-resizeBy);
} else {
addAll(List<T>.filled(resizeBy, fill));
}
}