//1.创建集合对象
//()遍历构造器
NSSet *set = [NSSet setWithObjects:@"1", @"2", @"3", @"4", @"5", nil];
NSLog(@"set = %@", set);
//()初始化方法
NSSet *set1 = [[NSSet alloc] initWithObjects:@"1", @"2", @"3", @"4", @"5", nil];
NSLog(@"set1 = %@", set1);
//2.求集合元素个数
NSLog(@"%ld", [set count]);
//3.获取集合中的某个元素
NSString *str = [set anyObject];
NSLog(@"%@", str);
NSString *str1 = [set anyObject];
NSLog(@"%@", str1);
NSString *str2 = [set anyObject];
NSLog(@"%@", str2);
NSString *str3 = [set anyObject];
NSLog(@"%@", str3);
//4.判断集合中是否包含某个对象
BOOL isExist = [set containsObject:@"3"];
NSLog(@"%d", isExist);
//可变集合
NSMutableSet *set2 = [NSMutableSet setWithObjects:@"1", @"2", @"3", @"4", @"5", nil];
NSMutableSet *set3 = [[NSMutableSet alloc] initWithObjects:@"1", @"2", @"3", @"4", @"5", nil];
//1.添加元素
[set2 addObject:@"6"];
NSLog(@"set2 = %@", set2);
//2.删除元素
[set2 removeObject:@"4"];
NSLog(@"set2 = %@", set2);