• 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: Retain counts with a dictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retain counts with a dictionary


  • Subject: Re: Retain counts with a dictionary
  • From: Angela Brett <email@hidden>
  • Date: Sun, 16 Mar 2003 15:02:37 +1200

2. Is it okay to use @"" for the objects in the loop? Will that create a new null string for each addition, or reuse the same one? Is there a better way?

Like others have already said, for your purposes an NSMutableSet is probably better. But you would probably find it useful to know that there is an object especially made for putting into collections where you would want to put nil - NSNull. NSNull is a singleton so you know for sure that it will be putting the same one in there each time - in fact, you can even use == to compare an object with [NSNull null] instead of using isEqual:

It's just a bit nicer than using empty strings, especially if you wanted an empty string to mean something other than the absence of any value.
--
Angela Brett
email@hidden
http://acronyms.co.nz/angela
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: Retain counts with a dictionary (From: Greg Titus <email@hidden>)

  • Prev by Date: Re: Retain counts with a dictionary
  • Next by Date: Finding an App by file id?
  • Previous by thread: Re: Retain counts with a dictionary
  • Next by thread: Re: Retain counts with a dictionary
  • Index(es):
    • Date
    • Thread