The collection.resize( ) method sets the collection length to the specified new size and returns the resized collection.
Note: This method modifies the original collection.
- If size < collection length, exceeding elements are removed from the collection.
- If size > collection length, the collection length is increased to size.
By default, new elements are filled will null values. You can specify the value to fill in added elements using the defaultValue parameter.