Package | starling.utils |
Class | public class ArrayUtil |
Inheritance | ArrayUtil Object |
Many methods of the Array class cause the creation of temporary objects, which is problematic for any code that repeats very often. The utility methods in this class can be used to avoid that.
Method | Defined By | ||
---|---|---|---|
insertAt(array:Array, index:int, object:Object):void [static] Inserts an element into the array at the specified index. | ArrayUtil | ||
removeAt(array:Array, index:int):Object [static] Removes the element at the specified index from the array. | ArrayUtil |
insertAt | () | method |
public static function insertAt(array:Array, index:int, object:Object):void
Inserts an element into the array at the specified index.
You can use a negative integer to specify a position relative to the end of the
array (for example, -1 will insert at the very end). If index
is
higher than the array length, gaps are filled up with null
values.
Parameters
array:Array | |
index:int | |
object:Object |
removeAt | () | method |
public static function removeAt(array:Array, index:int):Object
Removes the element at the specified index from the array. You can use a negative integer to specify a position relative to the end of the array (for example, -1 will remove the last element).
Parameters
array:Array | |
index:int |
Object |