Packagecom.desuade.utils
Classpublic class ArrayHelper
InheritanceArrayHelper Inheritance Object

Language Version : ActionScript 3
Since : 22.11.2009
Runtime Versions : AIR 1.0, Flash Player 9.0.0

Helper methods for Arrays



Public Methods
 MethodDefined By
  
aInB(a:Array, b:Array):Array
[static] Finds what values in array a that are in array b.
ArrayHelper
  
aNotInB(a:Array, b:Array):Array
[static] Finds what values in array a are not in array b.
ArrayHelper
  
removeDuplicates(array:Array, duplicates:Boolean = false):Array
[static] This returns an Array that's cleaned of duplicates from the given Array.
ArrayHelper
  
squeeze(array:Array, item:Object, length:int = 0):void
[static] This adds an item to the end of the specified Array and removes the first item only if it's full.
ArrayHelper
  
unsqueeze(array:Array, item:Object, length:int = 0):void
[static] This adds an item to the beginning of the specified Array and removes the last item only if it's full.
ArrayHelper
Method Detail
aInB()method
public static function aInB(a:Array, b:Array):Array

Finds what values in array a that are in array b.

Parameters

a:Array — The first array
 
b:Array — The second array

Returns
Array — An array of values that a has, which is also found somewhere in b
aNotInB()method 
public static function aNotInB(a:Array, b:Array):Array

Finds what values in array a are not in array b.

Parameters

a:Array — The first array
 
b:Array — The second array

Returns
Array — An array of values that a has, which are not found in b
removeDuplicates()method 
public static function removeDuplicates(array:Array, duplicates:Boolean = false):Array

This returns an Array that's cleaned of duplicates from the given Array. This does not modify the original Array.

Parameters

array:Array — The Array to use
 
duplicates:Boolean (default = false) — To return the duplicates instead

Returns
Array — A new Array with no duplicates from the original
squeeze()method 
public static function squeeze(array:Array, item:Object, length:int = 0):void

This adds an item to the end of the specified Array and removes the first item only if it's full.

Parameters

array:Array — The Array to modify
 
item:Object — The item to add
 
length:int (default = 0) — The max length the Array can be. Defaults to no max length, and will not squeeze.

unsqueeze()method 
public static function unsqueeze(array:Array, item:Object, length:int = 0):void

This adds an item to the beginning of the specified Array and removes the last item only if it's full.

Parameters

array:Array — The Array to modify
 
item:Object — The item to add
 
length:int (default = 0) — The max length the Array can be. Defaults to no max length, and will not squeeze.