GODPAPER | All Packages | All Classes | Index | Frames No Frames |
ArrayUtil

Package | org.spicefactory.lib.util
Class | public class ArrayUtil
Inheritance | ArrayUtil Object

Static utility methods for Arrays.

Public Methods

| Method | Defined By
--- | --- | ---
|  | contains(arr:Array, element:*):Boolean [static] Checks whether the Array contains the specified element. | ArrayUtil
|  | indexOf(arr:Array, element:*):int [static] Returns the index of the first occurence of the specified element in the Array or -1 if the Array does not contain that element. | ArrayUtil
|  | lastIndexOf(arr:Array, element:*):int [static] Returns the index of the last occurence of the specified element in the Array or -1 if the Array does not contain that element. | ArrayUtil
|  | remove(arr:Array, element:*):Boolean [static] Removes the specified instance from the Array. | ArrayUtil

Method Detail

contains | () | method

`public static function contains(arr:Array, element:*):Boolean`

Checks whether the Array contains the specified element.

Parameters

| `arr:Array` — the Array to examine
| `element:*` — the element to look for

Returns

| `Boolean` — true if the Array contains the specified element

indexOf | () | method |

`public static function indexOf(arr:Array, element:*):int`

Returns the index of the first occurence of the specified element in the Array or -1 if the Array does not contain that element.

Parameters

| `arr:Array` — the Array to examine
| `element:*` — the element to return the index for

Returns

| `int` — the zero-based index of the first occurence of the specified element or -1 if the Array does not contain that element

lastIndexOf | () | method |

`public static function lastIndexOf(arr:Array, element:*):int`

Returns the index of the last occurence of the specified element in the Array or -1 if the Array does not contain that element.

Parameters

| `arr:Array` — the Array to examine
| `element:*` — the element to return the index for

Returns

| `int` — the zero-based index of the last occurence of the specified element or -1 if the Array does not contain that element

remove | () | method |

`public static function remove(arr:Array, element:*):Boolean`

Removes the specified instance from the Array.

Parameters

| `arr:Array` — the Array to remove the element from
| `element:*` — the element to remove

Returns

| `Boolean` — true if the Array contained the specified element

Thu Jan 16 2014, 01:11 PM +08:00