Skip to content
Armen edited this page Apr 29, 2012 · 14 revisions

Implements an array-like collection
Defined in collection.js

Summary

a2d.Collection()

Method Summary

**[append](#append)** (other) Append the contents of another collection to this one.
_number_ **[indexOf](#indexOf)** (item) Get the index of the given item in the collection
_any_ **[pop](#pop)** Remove item from the end of the collection and return it.
**[push](#push)** (item) Add an item to the end of the collection
_any_ **[remove](#remove)** (idx) Remove item at given index
_any_ **[shift](#shift)** Remove the first item from the collection and return it.
**[unshift](#unshift)** (item) Add an item to the beginning of this collection
### Property Summary
**[length](#length)** length of the collection

Detail

a2d.Collection()


Method Detail

append (other)
Append the contents of another collection to this one.

Parameters:

{a2d.Collection} other

-- {number} indexOf (item)
Get the index of the given item in the collection

Parameters:

{any} item

Returns:

{number}
the index

-- {any} pop
Remove item from the end of the collection and return it.

Returns:

{any}
the removed item

-- push (item)
Add an item to the end of the collection

Parameters:

{any} item

-- {any} remove (idx)
Remove item at given index

Parameters:

{number} idx

Returns:

{any}
the removed item

-- {any} shift
Remove the first item from the collection and return it.

Returns:

{any}
the removed item

-- unshift (item)
Add an item to the beginning of this collection

Parameters:

{any} item

Returns:

the new length of the collection


Property Detail

length
length of the collection


Clone this wiki locally