• 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 NSArray?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Search NSArray?


  • Subject: Re: Search NSArray?
  • From: Ken Anderson <email@hidden>
  • Date: Thu, 28 Feb 2008 12:06:42 -0500

Or, if you do have a lot of objects that you look up often from your cache, upon loading:

NSMutableDictionary personBySSN = new NSMutableDictionary();

In loop:
	personBySSN.setObjectForKey(person, person.ssn());

Then to lookup:

person = (Person) personBySSN.objectForKey(ssn);


Of course, you should only do this with keys that you know are always there, and always unique...


Ken

On Feb 10, 2008, at 11:16 AM, Mike Schrag wrote:

NSArray results = EOQualifier.filteredArrayWithQualifier(array, qualifier);

or if you use Wonder:

NSArray<Something> results = ERXQ.filtered(array, qualifier);

ms

On Feb 10, 2008, at 10:56 AM, Drew Thoeni wrote:

I'm thinking this is a newbie question, but I can't seem to find an answer in the docs (likely I'm reading them incorrectly).

Situation:

I'm pulling objects into an NSArray to reduce multiple lookups later.

So, I have these objects and I want to do a lookup of one object in the NSArray. But all I have is the value of one element of the object in the array.

Example:

NSArray anArray = EOUtilities...; // gets about 1,000 person objects from the database

Now I'd like to find a single object in anArray based on SSN.

It seems that anArray.indexOfObject( object ); is intended to do this but I don't have the object, I only have an identifier for the object.

I'm sure this is handled, but am out of channels to research.

Thanks

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


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

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Search NSArray? (From: Drew Thoeni <email@hidden>)
 >Re: Search NSArray? (From: Mike Schrag <email@hidden>)

  • Prev by Date: Re: Owns destination confusion
  • Next by Date: Re: Owns destination confusion
  • Previous by thread: Re: Search NSArray?
  • Next by thread: Components and the Memory Game
  • Index(es):
    • Date
    • Thread