Folks;
I have an array of 'Suspect' objects which have 'names', 'capeSize',
'hatSize', 'planetOfOrigin', all the usual stuff...
Now I also have a list of 'RebelOutposts'; a set of 'planet' name
strings,
What I want to do is remove from a usualSuspects array of Suspects any
Suspect whose 'planetOfOrigin' is in my rebelOutpost set.
Here's the wrinkle that makes my brow crinkle: I really want a
generic solution that would allow me to remove based on
'fingerprints', or ....
Here's what I'm proposing:
NSSet *workingSet = [NSSet setWithArray:usualSuspects];
NSString *searchOnKey = @"planetOfOrigin"
NSSet *removeMatchingValuesSet = [NSSet setWithSet: rebelOutpost];
offTheHook = [workingSet filteredSetUsingPredicate:[NSPredicate
predicateWithFormat:@"NOT(%K IN %@)", searchOnKey,
removeMatchingValuesSet]];
(Hopefully you can see how this lends itself to wrapping in method
with 3 parameters)
Is there a gotcha hiding in there? Nulls?
Is there a better way?
Thanks!
Steve
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com