Object-C-Foundation-set
2015-06-08 11:19
429 查看
无序集合 哈希表
NSSet *colors=[NSSet setWithObjects:@@"yellow",@"red",@"blue",@"black",nil];
NSArray *array=[colors allObjects];
NSString *obj = [colors anyObject];
枚举器
NSEnumerator *numerator=[colors objectEnumerator];
for(id obj in numerator){
NSLog(@"%@",obj);
}
NSSet colors2=[NSSet setWithObjects:@"yellow",nil];
if([colors intersectsSet:colors2]){}判断两个set是否有相同的东西
还有 isSubsetOfSet 判断是否是子集
NSmutableSet常用方法
addObject
removeObject
removeAllobjects
unionSet合并两个集合
minusSet 减法操作
NSMutableSet *set1=[NSMutableSet setWithObjects:@"yellow",@"red",nil];
NSMutableSet *set1=[NSMutableSet setWithObjects:@"yellow",nil];
NSSet *colors=[NSSet setWithObjects:@@"yellow",@"red",@"blue",@"black",nil];
NSArray *array=[colors allObjects];
NSString *obj = [colors anyObject];
枚举器
NSEnumerator *numerator=[colors objectEnumerator];
for(id obj in numerator){
NSLog(@"%@",obj);
}
NSSet colors2=[NSSet setWithObjects:@"yellow",nil];
if([colors intersectsSet:colors2]){}判断两个set是否有相同的东西
还有 isSubsetOfSet 判断是否是子集
NSmutableSet常用方法
addObject
removeObject
removeAllobjects
unionSet合并两个集合
minusSet 减法操作
NSMutableSet *set1=[NSMutableSet setWithObjects:@"yellow",@"red",nil];
NSMutableSet *set1=[NSMutableSet setWithObjects:@"yellow",nil];
相关文章推荐
- Object-C-NSDictionary
- Objective-C关键字self和super详解
- GitHub 上排名前 100 的 Objective-C 项目简介
- Objective-C Autorelease Pool 的实现原理
- 使用 powerdesigner 15的Object Oriented Model生成 nhibernate实体类,映射文件和数据访问层
- Objective-C单例模式实现
- Objective-c set方法,get方法
- Objective-C 字典NSDictionary用法
- Objective-c 装箱和拆箱
- 类的内部是否应该直接访问实例变量
- 阅读《Effective Objective-C 2.0 编写高质量iOS与OS X代码的52个有效方法》总结
- [Objective-C] 005_Category(类别)
- 理解“属性”
- 十分钟让你明白Objective-C的语法(和Java、C++的对比)
- CVPR2014 Objectness源码转换(完整版) VS2012 X64 –>win32
- object_c id 与 instancetype
- object-c面向对象2
- Object-C中的一些常见问题及解答
- objective-c 中随机数的用法 (3种:arc4random() 、random()、CCRANDOM_0_1() )
- objective-c 异常处理