• 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: Searching NSArray of EO objects for key value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Searching NSArray of EO objects for key value


  • Subject: Re: Searching NSArray of EO objects for key value
  • From: Chris Hanson <email@hidden>
  • Date: Sat, 10 Jul 2004 13:22:40 -0700

On Jul 8, 2004, at 8:19 PM, Randall Perry wrote:
I've got an NSArray of EO objects from a db fetch. I need to search the
objects in the array to see if one key value matches a variable.

[snip]

What's the best way to do this? Should I just iterate through the array
checking each object's key value, or is there a shortcut?

Either filter the array using a qualifier, or call either EOUtilities.objectsMatchingKeyAndValue, EOUtilities.objectsMatchingValues, or EOEditingContext.objectsWithFetchSpecification.


If you're doing the database fetch specifically to bring in objects to filter, you should really do the filter at the same time and let the database do the work when it can; calling any of the above three methods allows that to happen transparently.

The moral: Leverage the frameworks. :)

  -- Chris

--
Chris Hanson <email@hidden>
http://www.livejournal.com/users/chanson/
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Searching NSArray of EO objects for key value (From: Randall Perry <email@hidden>)

  • Prev by Date: Re: in memory EOSortOrdering
  • Next by Date: Renaming a Project
  • Previous by thread: Re: Searching NSArray of EO objects for key value
  • Next by thread: WebObjects Builder ... again
  • Index(es):
    • Date
    • Thread