Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
6 NSArray *array = [NSArray arrayWithObjects: 7 @"set", @"object", @"containing", 8 @"seven", @"objects", @"not", 9 @"eight", @"objects", nil]; 10 NSSet *set = [NSSet setWithArray: array]; 11 NSMutableSet *mSet = [set mutableCopy]; 12 NSCountedSet *cSet = 13 [NSCountedSet setWithArray: array]; |
If you want to store a collection of objects without a defined order, you can use NSSet and its mutable subclass. This models a mathematical set, so inserting the same object twice will only store one copy of it.