Dictionary or Array?
Dictionary or Array?
- Subject: Dictionary or Array?
- From: Lorenzo <email@hidden>
- Date: Fri, 13 Jun 2003 14:50:10 +0200
Hi list,
I have a small database I created using a NSMutableArray of
NSMutableDictionary records.
e.g. If I need to get the field "name" of the record number 2 I do:
name = [[databaseArray objectAtIndex:2] objectForKey:@"name"];
Now I would like to get a pointer to the array containing all the entries
for the field "name" in order to get the list of all the "names" in my
database;
Currently I iterate through the databaseArray and get one by one all the
"name" entries. This requires time. And up above it's not dynamic because if
the user adds a record or modifies a record, I have to rebuild the "names"
array list.
Is there a way to get "a pointer" to the vertical "names" array?
I thought to rebuild the database using a vertical NSMutableArray for each
field. Then in order to get a record I should iterate through the fields.
name = [namesArray objectAtIndex:2];
surname = [surnamesArray objectAtIndex:2];
...
Is it a good idea?
Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.