标签:
无序集合 哈希表
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];
标签:
原文地址:http://www.cnblogs.com/Opaser/p/4560442.html