Compare 2 nsmutablearray and get different object to third array in ios

cocoa-touch, ios, nsmutablearray, objective-c

Solution

Use sets for set operations:

NSSet *set1 = [NSSet setWithArray:array1];
NSMutableSet *set2 = [NSMutableSet setWithArray:array2];
[set2 minusSet:set1];

Problem

I want to compare 2 `NSMutableArray` and get different object into third `Array`. How can i do that ? Array1 can loop object . ``` Array1 = "a", "b","c","d","a","b","c"; Array2 = "a", "b", "c"; ``` And then result ``` Array3 = "d"; ``` Thanks in advance

Original source