If you can't get an object with objectAtIndex: from an NSSet then how do you retrieve objects?
See Question&Answers more detail:osIf you can't get an object with objectAtIndex: from an NSSet then how do you retrieve objects?
See Question&Answers more detail:osThere are several use cases for a set. You could enumerate through (e.g. with enumerateObjectsUsingBlock
or NSFastEnumeration), call containsObject
to test for membership, use anyObject
to get a member (not random), or convert it to an array (in no particular order) with allObjects
.
A set is appropriate when you don't want duplicates, don't care about order, and want fast membership testing.