Yahoo! UI Library

collection  3.1.0

Yahoo! UI Library > collection > ArrayList~add
Search:
 
Filters

Class ArrayList~add

Adds methods add and remove to Y.ArrayList

Methods

add

ArrayList add ( item , index )
Add a single item to the ArrayList. Does not prevent duplicates.
Parameters:
item < mixed > Item presumably of the same type as others in the ArrayList
index <Number> (Optional.) Number representing the position at which the item should be inserted.
Returns: ArrayList
the instance
Chainable: This method is chainable.

itemsAreEqual

Boolean itemsAreEqual ( a , b )
Default comparitor for items stored in this list. Used by remove().
Parameters:
a < mixed > item to test equivalence with
b < mixed > other item to test equivalance
Returns: Boolean
true if items are deemed equivalent

remove

ArrayList remove ( needle , all , comparitor )
Removes first or all occurrences of an item to the ArrayList. If a comparitor is not provided, uses itemsAreEqual method to determine matches.
Parameters:
needle < mixed > Item to find and remove from the list
all < Boolean > If true, remove all occurrences
comparitor < Function > optional a/b function to test equivalence
Returns: ArrayList
the instance
Chainable: This method is chainable.


Copyright © 2010 Yahoo! Inc. All rights reserved.