objective c - Check common values between two NSArray of NSDictionaries -


i have 2 nsarray, noticloud , notiloc, both nsdictonary of same structure. need know how check how many nsdictionary in both nsarray, instance using key @"id".

many thanks.

// create arrays of ids nsarray *noticloudids = [noticloud valueforkey:@"id"]; nsarray *notilocids = [notiloc valueforkey:@"id"];  // turn arrays sets , intersect 2 sets nsmutableset *noticloudidsset = [nsmutableset setwitharray:noticloudids]; nsmutableset *notilocidsset = [nsmutableset setwitharray:notilocids]; [noticloudidsset intersectset:notilocidsset];  // ids in noticloudidsset have been present in both arrays nslog(@"duplicate ids: %@", noticloudidsset); 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -