• 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: Search fast in NSDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Search fast in NSDictionary


  • Subject: Re: Search fast in NSDictionary
  • From: Sean Murphy <email@hidden>
  • Date: Mon, 23 Oct 2006 14:33:57 -0400

On Oct 23, 2006, at 6:16 AM, xidiar wrote:

I'm searching a function to search within a string of an NSDictionary fast as iTunes search method.

Any idea?
How can I use Hashing for it?

One way of accomplishing this is to obtain an array of either the keys or values (depending on which components of the dictionary you want to search through) and filter that array using a predicate.


So, call either [dict allValues] or [dict allKeys] and then use NSArray's filteredArrayUsingPredicate: to return an new array containing objects that match the search term.

This is just one (10.4+) method of doing this. It's probably the easiest, but maybe performance stands to gain using another technique. I often use Apple's and other standard library methods and functions instead of rolling my own, since the prior are likely to be more efficient, well tested, and heavily optimized.

Good luck,
Sean
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Search fast in NSDictionary (From: xidiar <email@hidden>)

  • Prev by Date: Re: Focus Rings
  • Next by Date: Re: Focus Rings
  • Previous by thread: Search fast in NSDictionary
  • Next by thread: Re: Search fast in NSDictionary
  • Index(es):
    • Date
    • Thread