• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is checking -count worth it?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is checking -count worth it?


  • Subject: Re: Is checking -count worth it?
  • From: Ken Thomases <email@hidden>
  • Date: Thu, 24 Jul 2008 03:45:39 -0500

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 (email@hidden)

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:
This email sent to email@hidden


References: 
 >Is checking -count worth it? (From: Steve Cronin <email@hidden>)
 >Re: Is checking -count worth it? (From: Jens Alfke <email@hidden>)
 >Re: Is checking -count worth it? (From: Matthew Schinckel <email@hidden>)

  • Prev by Date: Re: Sent Actions, Delegates, Outlets
  • Next by Date: Re: Help on Menu Item
  • Previous by thread: Re: Is checking -count worth it?
  • Next by thread: Re: Is checking -count worth it?
  • Index(es):
    • Date
    • Thread