When is it better to use an NSSet over an NSArray?
arrays, cocoa, cocoa-touch, ios, objective-c
Solution
When the order of the items in the collection is not important, sets offer better performance for finding items in the collection.
The reason is that a set uses hash values to find items (like a dictionary) while an array has to iterate over its entire contents to find a particular object.
Problem
I have used NSSets many times in my apps, but I have never created one myself. When is it better to use an `NSSet` as opposed to an `NSArray` and why?