On Jul 24, 2008, at 2:02 AM, Matthew Schinckel wrote:
Am I better off in general (ie, adding objects, removing objects, etc) using an NS(Mutable)Set instead of an NSArray, if I don't need sorting and duplicate items?
Since the semantics of an NSSet are "looser" than those for an NSArray (as you point out), then you can freely use an NSSet wherever you don't need the tighter semantic requirements of an array. The looser requirements allow for greater flexibility in implementation.
Think of it this way: if NSArray were really faster/cheaper than an NSSet, then you can assume that NSSet would use an NSArray for its implementation and they'd be equivalent.
However, beyond any consideration of performance, just use the data structure which accurately reflects the semantics of your design. From a design perspective, is your to-many relationship a set or an array?
Cheers, Ken _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]