Packageorg.aswing.util
Classpublic class ArrayUtils

Utils functions about Array.



Public Methods
 MethodDefined by
  
cloneArray(arr:Array):Array
[static]
ArrayUtils
  
each(arr:Array, operation:Function):void
[static] Call the operation by pass each element of the array once.
ArrayUtils
  
indexInArray(arr:Array, obj:Object):int
[static]
ArrayUtils
  
removeAllBehindSomeIndex(array:Array, index:int):void
[static]
ArrayUtils
  
removeAllFromArray(arr:Array, obj:Object):void
[static]
ArrayUtils
  
removeFromArray(arr:Array, obj:Object):int
[static] Removes the object from the array and return the index.
ArrayUtils
  
setSize(arr:Array, size:int):void
[static] Sets the size of the array.
ArrayUtils
Method detail
cloneArray()method
public static function cloneArray(arr:Array):ArrayParameters
arr:Array

Returns
Array
each()method 
public static function each(arr:Array, operation:Function):void

Call the operation by pass each element of the array once.

for example:

  //hide all component in vector components
  ArrayUtils.each( 
      components,
      function(c:Component){
          c.setVisible(false);
      });
  
  Parameters
arr:Array — the array for each element will be operated.
 
operation:Function — operation function for each element

See also

indexInArray()method 
public static function indexInArray(arr:Array, obj:Object):intParameters
arr:Array
 
obj:Object

Returns
int
removeAllBehindSomeIndex()method 
public static function removeAllBehindSomeIndex(array:Array, index:int):voidParameters
array:Array
 
index:int
removeAllFromArray()method 
public static function removeAllFromArray(arr:Array, obj:Object):voidParameters
arr:Array
 
obj:Object
removeFromArray()method 
public static function removeFromArray(arr:Array, obj:Object):int

Removes the object from the array and return the index.

Parameters
arr:Array
 
obj:Object

Returns
int — the index of the object, -1 if the object is not in the array
setSize()method 
public static function setSize(arr:Array, size:int):void

Sets the size of the array. If the new size is greater than the current size, new undefined items are added to the end of the array. If the new size is less than the current size, all components at index newSize and greater are removed.

Parameters
arr:Array — the array to resize
 
size:int — the new size of this vector