I have an array and a Dictionary and I would like to run some for loops to see if the elements in the array are equal to each of the keys in the Dictionary.
Is there a way to do this using开发者_开发技巧 objective-c?
NSMutableSet *intersection = [[NSMutableSet alloc] init];
[intersection addObjectsFromArray:array];
[intersection intersectSet:[NSSet setWithArray:[dictionary allKeys]]];
intersection
contains a set of the objects that exists both as keys in your dictionary and in your array.
精彩评论