• 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: Selecting an object based on the value of one of its attributes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selecting an object based on the value of one of its attributes


  • Subject: Re: Selecting an object based on the value of one of its attributes
  • From: vincent habchi <email@hidden>
  • Date: Wed, 28 Apr 2010 08:23:08 +0200

Le 28 avr. 2010 à 04:37, Lynn Barton a écrit :

> Newbie question: Consider an array of dictionary objects, all of the same class. One of the ivars of that class is an NSString which is unique for each instance. Does there already exist a method that will identify the one dictionary object that has a given value of that ivar, without me having to write code to examine all of the objects one by one?

Use a hash code. That's the way NSDictionary class search for keys. It is way faster than simple linear search, especially if you have thousands of elements. But it is more code and memory expensive.

Vincent

_______________________________________________

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: 
 >Selecting an object based on the value of one of its attributes (From: Lynn Barton <email@hidden>)

  • Prev by Date: Re: menu madness with retain count
  • Next by Date: Re: NSCalendar date calculation anomaly
  • Previous by thread: Re: Selecting an object based on the value of one of its attributes
  • Next by thread: NSCalendar date calculation anomaly
  • Index(es):
    • Date
    • Thread