Seeker
Seeker

Reputation: 2475

what happens when i say arrayCollection.addItemAt(object,0);

Lets say i have an Array collection, filled with some elements. If i say

myArrayCollection.addItemAt(object,0);

What exactly happens here? Does all the elements gets shifted rigthwards? or element at 0th position gets replaced with new one?

Upvotes: 1

Views: 1224

Answers (1)

Amy Blankenship
Amy Blankenship

Reputation: 6961

To summarize, the reason there are two different methods, addItemAt() and setItemAt(), is because one of them adds a new item (not replacing any of the existing ones), and the other sets/overwrites the existing index.

For more info, check out the ArrayCollection documentation.

Upvotes: 5

Related Questions