ArrayUtil.create()

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5148 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Tom Conkling
2008-05-30 18:22:24 +00:00
parent 214d464c7f
commit 6c34b9e3ed
+15
View File
@@ -30,6 +30,21 @@ package com.threerings.util {
*/
public class ArrayUtil
{
/**
* Creates a new Array and fills it with a default value.
* @param size the size of the array
* @param val the value to store at each index of the Array
*/
public static function create (size :uint, val :* = null) :Array
{
var arr :Array = new Array(size);
for (var ii :uint = 0; ii < size; ii++) {
arr[ii] = val;
}
return arr;
}
/**
* Creates a shallow copy of the array.
*