首页 > 其他 > 详细

nsset

时间:2016-01-11 13:51:47      阅读:190      评论:0      收藏:0      [点我收藏+]

 

#define NSLog(FORMAT, ...) printf("%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String])

#import <Foundation/Foundation.h>

 

int main(int argc, const char * argv[]) {

    @autoreleasepool {

        NSMutableSet *set1=[NSMutableSet set];

        NSMutableSet *set2=[NSMutableSet setWithObjects:@"1",@"2", nil];

        NSMutableSet *set3=[NSMutableSet setWithObjects:@"a",@"2", nil];

        //集合2减集合3,最后集合2中元素只剩1个,值为1;

//        NSLog(@"%@",set2);

//        NSLog(@"%@",set3);

//        [set2 minusSet:set3];

//        NSLog(@"%@",set2);

//        NSLog(@"%@",set3);

        //集合2与集合3交集,最后集合2中元素只有一个值为2

//        [set2 intersectSet:set3];

//        NSLog(@"%@",set2);

//        NSLog(@"%@",set3);

        //集合2与集合3并集,最后集合2中的元素只有3个1,2,a

//        [set2 unionSet:set3];

//        NSLog(@"%@",set2);

//        NSLog(@"%@",set3);

        

        //

//        [set2 removeObject:@"2"];

//        NSLog(@"%@",set2);

        [set1 setSet:set2];

        NSLog(@"%@",set1);    

    }

    return 0;

}

 

nsset

原文:http://www.cnblogs.com/bobohahaha/p/5120739.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!