Re: Remove Duplicates in a NSArray
site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Hi, Andre Masse On Oct 1, 2008, at 07:29, Rashmi Vyshnavi wrote: Hi All, E.g. NSDictionary *dict1 = [NSDictionary dictionaryWithObjectsAndKeys:@ "testVal",@"testKey",....,nil]; NSDictionary *dict2 = [NSDictionary dictionaryWithObjectsAndKeys:@ "testVal1",@"testKey",....,nil]; NSDictionary *dict3 = [NSDictionary dictionaryWithObjectsAndKeys:@ "testVal3",@"testKey",....,nil]; NSDictionary *dict4 = [NSDictionary dictionaryWithObjectsAndKeys:@ "testVal",@"testKey",....,nil]; NSArray *arrDicts = [NSArray arrayWithObjects:dict1,dict2,dict3,dict4,nil]; -- Rashmi _______________________________________________ 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/andre.masse%40videotron.ca _______________________________________________ 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/site_archiver%40lists.apple... NSArray and NSDictionary are one shot objects. Once you've created them, they're read-only. You need to use the "mutable" version for adding/removing objects inside a collection. See NSMutableDictionary, NSMutableArray etc. Is there a way to remove dictionary item containing same values for a key from a array of dictionaries? In the above code I want to remove the multiple dictionaries containing "testVal" and maintain only one dictionary containing "testVal" in the array "arrDict". This email sent to andre.masse@videotron.ca This email sent to site_archiver@lists.apple.com
participants (1)
-
Andre Masse