NSSet, NSMutableSet

Sets are bags which hold a finite number of objects.

+(id)setWithArray:(NSArray*)arr creates a new set with all the objects in the array (9.3)
+(id)setWithObjects:,.. creates a new set with all the list of passed objects. The list must end with ,nil.
-(BOOL)containsObject:(id)obj true if this set contains the given object
-(int)count returns the number of objects in the set
-(NSEnumerator*)objectEnumerator return an enumerator (9.6) over all objects in set
-(NSArray*)allObjects return an array (9.3) of all objects in this set

NSMutableSet also implements the following methods:

-(id)addObject:(id)obj add an object to the set
-(void)removeObject:(id)obj remove object from the set
-(void)removeAllObjects remove all objects from this set
-(void)minusSet:(NSSet*)set2 remove all objects from this set which are also in set2
-(void)intersectSet:(NSSet*)set2 keep only objects which are in both sets
-(void)unionSet:(NSSet*)set2 add all objects from set2 to this set

moltalk@moltalk.org      version of this document: V3.0