• 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: null values in NSArray ???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: null values in NSArray ???


  • Subject: Re: null values in NSArray ???
  • From: Dennis De Mars <email@hidden>
  • Date: Fri, 17 Jan 2003 08:09:04 -0800

I wouldn't try to trick NSMutableArray into accepting nil entries, since the implementation probably relies on these entries being non-nil throughout the class. This is what NSNull is for.

NSNull is a singleton (one unique instance) so you don't incur any allocation overhead by using it. If you don't even want to incur the overhead of a method call you can just put it into a local variable and use that wherever you wanted to use nil.

- Dennis D.

On Friday, January 17, 2003, at 07:48 AM, Bob Miller wrote:

Hello,

Can anyone tell me if it is possible to manage an NSMutableArray that contains null values for objects at any given index ? I'd like to be able to have an array such as this so that each location can be filled as a 'place holder' so that if a particular object at any given index is null, it gets ignored or possibly populated with an object id. It seems that this would be a nice feature to have. I don't want to incur the overhead of the NSNull object allocation(s) in a large grid. Can it be done by catching the null object exception ?

Regards,
Bob M.
_______________________________________________
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.
_______________________________________________
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: 
 >null values in NSArray ??? (From: Bob Miller <email@hidden>)

  • Prev by Date: Re: atoi( ) deprecation question...
  • Next by Date: Re: null values in NSArray ???
  • Previous by thread: null values in NSArray ???
  • Next by thread: Re: null values in NSArray ???
  • Index(es):
    • Date
    • Thread