I have three NSMutableArray containing names that are added to the lists according to different criterieas.
Here are my arrays pseudocode:
NSMutableA
NSMutableArray *first = [[NSMutableArray alloc] initWithObjects:@"Jack", @"John", @"Daniel", @"Lisa",nil];
NSMutableArray *seconds =[[NSMutableArray alloc] initWithObjects:@"Jack", @"Bryan", @"Barney", @"Lisa",@"Penelope",@"Angelica",nil];
NSMutableArray *third = [ [ NSMutableArray alloc]init];
for (id obj in first) {
if ([seconds containsObject:obj] ) {
[third addObject:obj];
}
}
NSLog(@"third is : %@ \n\n",third);
OUTPUT:
third is : (
Jack,
Lisa
)