CollectionImpl

Kind of class:class
Inherits from:Object
Implements:
Classpath:mx.utils.CollectionImpl
File last modified:Tuesday, 18 December 2007, 15:44:38
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.

Summary


Constructor
Instance properties
Instance methods
  • addItem (item:Object) : Boolean
    • Adds a new item to the end of the Collection.
  • clear : Void
    • Removes all items from the Collection.
  • contains (item:Object) : Boolean
    • Returns true if this Collection contains the specified item.
  • getItemAt (index:Number) : Object
    • Returns an item within the Collection using it's index.
  • getIterator : Iterator
    • Returns an iterator over the elements in this collection.
  • getLength : Number
    • Returns the current length
  • isEmpty : Boolean
    • Returns true if the Collection is empty.
  • removeItem (item:Object) : Boolean
    • Removes a single item from the Collection.
  • internalGetItem (item:Object) : Number
    • Finds an item within the Collection and returns it's index.

Constructor

CollectionImpl

function CollectionImpl (
)

Initialize the Collection.

Instance properties

_items

private _items:Array
(read)

Instance methods

addItem

function addItem (
item:Object) : Boolean

Adds a new item to the end of the Collection.
Parameters:
item:
Object 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.
Specified by:

clear

function clear (
) : Void

Removes all items from the Collection.
Specified by:

contains

function contains (
item:Object) : Boolean

Returns true if this Collection contains the specified item.
Parameters:
item:
Object whose presence in this collection is to be tested.
Returns:
  • Boolean true if this collection contains the specified item.
Specified by:

getItemAt

function getItemAt (
index:Number) : Object

Returns an item within the Collection using it's index.
Parameters:
index:
location of item within the Collection.
Returns:
  • Object reference to item.
Specified by:

getIterator

function getIterator (

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.
Specified by:

getLength

function getLength (
) : Number

Returns the current length
Returns:
  • Number value reflecting the number of items in this Collection.
Specified by:

internalGetItem

private function internalGetItem (
item:Object) : Number

Finds an item within the Collection and returns it's index.
Parameters:
item:
reference to Collection item to be found
Returns:
  • Number location of item within the Collection.

isEmpty

function isEmpty (
) : Boolean

Returns true if the Collection is empty.
Returns:
  • Boolean true if Collection is empty.
Specified by:

removeItem

function removeItem (
item:Object) : Boolean

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.
Specified by: