copyOf
Returns a new array containing the same elements.
The copy has the same length and element type but its own mutable storage. Referenced objects are shared, not cloned.
Receiver
the array to copy.
Return
a distinct array containing these elements in order.
Type Parameters
the element type.
Returns a resized copy, padding extra elements with null.
Copies the first minOf(size, newSize) elements. A smaller size discards the tail; a larger size adds null elements. The result has a nullable element type even when shrinking. The source is unchanged. Referenced objects are shared, not cloned.
Receiver
the array to copy.
Return
a new array of newSize elements.
Parameters
the length of the result.
Type Parameters
the source element type.
Throws
if newSize is negative.
Returns a new array containing the same elements.
The copy has the same length and element type but its own mutable storage.
Receiver
the array to copy.
Return
a distinct array containing these elements in order.
Returns a resized copy, padding extra elements with false.
Copies the first minOf(size, newSize) elements. A smaller size discards the tail; a larger size adds false elements. The source is unchanged.
Receiver
the array to copy.
Return
a new array of newSize elements.
Parameters
the length of the result.
Throws
if newSize is negative.
Returns a resized copy, padding extra elements with zero.
Copies the first minOf(size, newSize) elements. A smaller size discards the tail; a larger size adds zero-valued elements. The source is unchanged.
Receiver
the array to copy.
Return
a new array of newSize elements.
Parameters
the length of the result.
Throws
if newSize is negative.
Returns a resized copy, padding extra elements with zero characters.
Copies the first minOf(size, newSize) elements. A smaller size discards the tail; a larger size adds '\u0000' characters. The source is unchanged.
Receiver
the array to copy.
Return
a new array of newSize elements.
Parameters
the length of the result.
Throws
if newSize is negative.