The collection.fill( ) method fills the collection with the specified value, optionally from startFrom index to end index, and returns the resulting collection.
Note: This method modifies the original collection.
- If the startFrom parameter is omitted, value is set to all collection elements (startFrom=0). If the end parameter is omitted, the value is set to the last element of the collection (end=length).
- If startFrom < 0, it is recalculated as startFrom:=startFrom+length (it is considered as the offset from the end of the collection). If the calculated value is negative, startFrom is set to 0.
- If end < 0 , it is recalculated as end:=end+length.
- If end < startFrom (passed or calculated values), the method does nothing.