Array.enlarge

Resize an array to a larger size, filling new entries with copies of a given value. If the new size is smaller than the old one, this method has no effect.

Arguments

The

value
to be used for filling new entries in the array.
newSize
is the new size of the array, an integer number.

Return values

None

Complexity

Amortized O(diff), where diff is the difference between the old size and the new size.

Example

"sl/array" useFile a: (1 2 0 5 "Hello" 0.3) makeArray; a [print "," print TRUE] enum "newElement" 8 a.enlarge LF print a [print "," print TRUE] enum
Output:
1,2,0,5,Hello,0.300000, 1,2,0,5,Hello,0.300000,newElement,newElement,