Constructors

Methods

Collection class

Collection

extends Object

 

 

Overview

Author

Adobe [http://www.adobe.com]
Ported to AS3 by Matt Przybylski [http://www.reintroducing.com]

Version

1.0

Description


Constructors

 

Collection

Usage

public function Collection():void

Description

Helper class used to manage a collection of objects. This class is similar to the Java Collection interface. Developers can extend this class to create new Collection types that provide additional functionality such as ordering and sorting.

Methods

 

addItem

Usage

public function addItem($item:*):Boolean

Description

Adds a new item to the end of the Collection.

Parameters

$item
* to be added to the Collection. If item is Null it will not be added to the Collection.

Returns

Boolean true if the Collection was changed as a result of the operation.
 

removeItem

Usage

public function removeItem($item:*):Boolean

Description

Removes a single item from the Collection. Returns false if item is not found.

Parameters

$item
reference to Collection item to be removed from Collection.

Returns

Boolean true if item is found and successfully removed. False if item is not found.
 

clear

Usage

public function clear():void

Description

Removes all items from the Collection.

Returns

Nothing
 

contains

Usage

public function contains($item:*):Boolean

Description

Returns true if this Collection contains the specified item.

Parameters

$item
* whose presence in this collection is to be tested.

Returns

Boolean true if this collection contains the specified item.
 

getItemAt

Usage

public function getItemAt($index:int):*

Description

Returns an item within the Collection using it's index.

Parameters

$index
location of item within the Collection.

Returns

reference to item.
 

getIterator

Usage

public function getIterator():Iterator

Description

Returns an iterator over the elements in this collection. There are no guarantees concerning the order in which the elements are returned (unless this collection is an instance of some class that provides a guarantee).

Returns

Iterator object that is used to iterate through the collection.
 

getLength

Usage

public function getLength():int

Description

Returns the current length

Returns

int value reflecting the number of items in this Collection.
 

isEmpty

Usage

public function isEmpty():Boolean

Description

Returns true if the Collection is empty.

Returns

Boolean true if Collection is empty.