Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSMutableSet vs NSMutableArray

What's the difference?

In my context, I need to be able to dynamically add to and remove objects. The user clicks on rows of a table that check on and off and thus add or remove the referenced object from the list.

A wild guess is that array has indexed items while set has no indexes?

like image 599
Brenden Avatar asked Jul 29 '09 21:07

Brenden


1 Answers

An NSSet/NSMutableSet doesn't keep items in any particular order. An NSArray/NSMutableArray does store the items in a particular order. If you're building a table view, you should definitely use an array as your data source of choice.

like image 195
Alex Avatar answered Oct 06 '22 04:10

Alex