ArrayUtil.create()
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5148 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -30,6 +30,21 @@ package com.threerings.util {
|
|||||||
*/
|
*/
|
||||||
public class ArrayUtil
|
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.
|
* Creates a shallow copy of the array.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user