• 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: NSDictionary allValues not mutable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDictionary allValues not mutable


  • Subject: Re: NSDictionary allValues not mutable
  • From: Charles Srstka <email@hidden>
  • Date: Mon, 18 Oct 2010 15:39:51 -0500

On Oct 18, 2010, at 1:45 PM, Trygve Inda wrote:

> So would you do something like the example you described:
>
> http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
>
> Where the NSArrayController is bound not to an array at all but to a
> property which responds to the proper indexed to-many messages...
>
> Or a subclass of NSMutableArray as Greg suggested?
>
> My array will rarely be edited (but needs to be mutable), but needs to be
> searchable by key (for which instead of a keyed dictionary kept in tandem
> with the array, I could just use a predicate filter on the array).
>
> Each dictionary (or object with properties) will need to hold roughly 9
> textual strings, and there will be on the order of 10,000 objects in the
> array. I am guessing that dictionary will perform better than a predicate
> filter given the number of objects.
>
> Trygve

I’d say the best solution is the one that Ken described. Implement the to-many accessors such as countOf<property>, objectIn<property>AtIndex:, insertObject:in<property>AtIndex:, and so forth. Then the underlying storage can be an NSDictionary, a skip list, or whatever you want, and as long as your accessors are abstracting it away properly, the rest of your code will neither know nor care what is actually being used to store your data.

Charles_______________________________________________

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

  • Follow-Ups:
    • Re: NSDictionary allValues not mutable
      • From: Trygve Inda <email@hidden>
    • Re: NSDictionary allValues not mutable
      • From: Trygve Inda <email@hidden>
References: 
 >Re: NSDictionary allValues not mutable (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: How to Distinguish Between Two TableViews
  • Next by Date: Re: How to Distinguish Between Two TableViews
  • Previous by thread: Re: NSDictionary allValues not mutable
  • Next by thread: Re: NSDictionary allValues not mutable
  • Index(es):
    • Date
    • Thread