Search This Blog

Monday, September 13, 2010

NSSet and NSMutableSet

//NSSet
NSSet *aSet = [NSSet alloc]initWithObjects
NSSet *aSet = [NSSet setWithObjects:@"one",@"two",@"three",nil];
[aSet initWithObjects:@"",@"",nil];
[aSet initWithSet:set2];
[aSet initWithArray:array];

//Count of an Set
[aSet count];

//Operations in Set
1.Intersection
[aSet intersectsSet:set2];
2.Union
[aSet unionSet:set2];
3.Remove Objects
[aSet removeObjects];
4.Minus
[aSet minusSet:set2];


//Adding Objects to the Set
NSMutableSet *mSet = [NSMutableSet setWithObjects:@"",nil];

[mSet setByAddingObject:@"Kumar"];
[mSet setByAddingObjectsFromSet:set2];
[mSet setByAddingObjectsFromArray:array];

No comments:

Post a Comment