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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com