Hi, I am attempting to de-dupe an NSArray of NSDictionaries based on specific keys in the dictionaries. What I have looks something like this:
NSDictionary *person1 = [NSDictionary dictionaryWithObjectsAndKeys:@"John", @"firstName", @"Smith", "lastName", @"7898", @"employeeID"];
NSDictionary *person2 = [NSDictionary dictionaryWithObjectsAndKeys:@"Eric", @"firstName", @"Johnson", "lastName", @"1718" @"employeeID"];
NSDictionary *person3 = [NSDictionary dictionaryWithObjectsAndKeys:@"John", @"firstName", @"Smith", "lastName", @"1153", @"employeeID"];
NSMutableArray *personArray = [NSArray arrayWithObjects:person1, person2, person3, nil];
// insert some code to de-dupe personArray based SOLELY on the firstName and lastName keys
Notice how there are two employees with the same name but different ID's. What I would like to do is just get back a new array with only person1 and person2, since person3 has the same data - I just don't care about the "employeeID" value in this particular problem.
Any ideas? Thanks!
-Matt