Packagecom.adobe.utils
Classpublic class ArrayUtil

Class that contains static utility methods for manipulating and working with Arrays. Note that all APIs assume that they are working with well formed arrays. i.e. they will only manipulate indexed values.



Public Methods
 MethodDefined by
  
arrayContainsValue(arr:Array, value:Object):Boolean
[static] Determines whether the specified array contains the specified value.
ArrayUtil
  
arraysAreEqual(arr1:Array, arr2:Array):Boolean
[static] Compares two arrays and returns a boolean indicating whether the arrays contain the same values at the same indexes.
ArrayUtil
  
copyArray(arr:Array):Array
[static] Creates a copy of the specified array.
ArrayUtil
  
createUniqueCopy(a:Array):Array
[static] Create a new array that only contains unique instances of objects in the specified array.
ArrayUtil
  
removeValueFromArray(arr:Array, value:Object):void
[static] Remove all instances of the specified value from the array,
ArrayUtil
Method detail
arrayContainsValue()method
public static function arrayContainsValue(arr:Array, value:Object):Boolean

Determines whether the specified array contains the specified value.

Parameters
arr:Array — The array that will be checked for the specified value.
 
value:Object — The object which will be searched for within the array

Returns
Boolean — True if the array contains the value, False if it does not.
arraysAreEqual()method 
public static function arraysAreEqual(arr1:Array, arr2:Array):Boolean

Compares two arrays and returns a boolean indicating whether the arrays contain the same values at the same indexes.

Parameters
arr1:Array — The first array that will be compared to the second.
 
arr2:Array — The second array that will be compared to the first.

Returns
Boolean — True if the arrays contains the same values at the same indexes. False if they do not.
copyArray()method 
public static function copyArray(arr:Array):Array

Creates a copy of the specified array. Note that the array returned is a new array but the items within the array are not copies of the items in the original array (but rather references to the same items)

Parameters
arr:Array — The array that will be copies

Returns
Array — A new array which contains the same items as the array passed in.
createUniqueCopy()method 
public static function createUniqueCopy(a:Array):Array

Create a new array that only contains unique instances of objects in the specified array. Basically, this can be used to remove duplication object instances from an array

Parameters
a:Array — The array which contains the values that will be used to create the new array that contains no duplicate values.

Returns
Array — A new array which only contains unique items from the specified array.
removeValueFromArray()method 
public static function removeValueFromArray(arr:Array, value:Object):void

Remove all instances of the specified value from the array,

Parameters
arr:Array — The array from which the value will be removed
 
value:Object — The object that will be removed from the array.