Skip to content

Commit

Permalink
ArrayUtil: Set default value to null
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimensionscape committed Jul 10, 2024
1 parent 5d276b1 commit 0b5a0a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/starling/utils/ArrayUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ArrayUtil {
* @param newSize The new size of the array.
* @param defaultValue The value to fill new elements with.
*/
public static function extend<T>(arr:Array<T>, newSize:Int, defaultValue:T):Void {
public static function extend<T>(arr:Array<T>, newSize:Int, defaultValue:T = null):Void {
while (arr.length < newSize) {
arr.push(defaultValue);
}
Expand All @@ -33,7 +33,7 @@ class ArrayUtil {
* @param newSize The new size of the array.
* @param defaultValue The value to fill new elements with when extending.
*/
public static function resize<T>(arr:Array<T>, newSize:Int, defaultValue:T):Void {
public static function resize<T>(arr:Array<T>, newSize:Int, defaultValue:T = null):Void {
if (newSize < arr.length) {
truncate(arr, newSize);
} else {
Expand Down

0 comments on commit 0b5a0a6

Please sign in to comment.