I have the following code:
NSMutableSet* localSet = [[NSMutableSet alloc] initWithArray:symbols];
NSMutableArray* fetchedSymbolsArray = [NSMutableArray array];
for (NSDictionary* symbol in fetchedSymbols) {
[fetchedSymbolsArray addObject:[NSDictionary dictionaryWithObject:[symbol valueForKey:@"symbol"] forKey:@"symbol"]];
}
NSMutableSet* serverSet = [[NSMutableSet alloc] initWithArray:fetchedSymbolsArray];
[localSet unionSet:serverSet];
for (NSDictionary* symbol in localSet) {
NSLog(@"%@",[symbol valueForKey:@"symbol"]);
}
I want everything in serverSet to be in localSet. This code does not reflect this.
It would also be preferable if any duplicates were not added to localSet.
EDIT: Here is my log:
2011-08-16 17:46:28.887 Stream[94612:207] YHOO
2011-08-16 17:46:28.887 Stream[94612:207] GOOG
2011-08-16 17:46:28.887 Stream[94612:207] INTC
2011-08-16 17:46:28.888 Stream[94612:207] BIDU
2011-08-16 17:46:28.888 Stream[94612:207] INTC
2011-08-16 17:46:28.888 Stream[94612:207] BIDU
2011-08-16 17:46:28.888 Stream[94612:207] AAPL
2011-08-16 17:46:28.888 Stream[94612:207] AAPL
2011-08-16 17:46:28.889 Stream[94612:207] AMD
2011-08-16 17:46:28.889 Stream[94612:207] GMCR