Yahoo! UI Library

collection  3.3.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 comparator 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 , comparator )
Removes first or all occurrences of an item to the ArrayList. If a comparator 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.
comparator < Function > optional a/b function to test equivalence.
Returns: ArrayList
the instance.
Chainable: This method is chainable.


Copyright © 2011 Yahoo! Inc. All rights reserved.