码迷,mamicode.com
首页 > 编程语言 > 详细

OC和Java

时间:2016-07-10 15:18:40      阅读:427      评论:0      收藏:0      [点我收藏+]

标签:

1-OC和Java中迭代

        NSSet *set1 = [NSSet setWithObjects:@"one", @"two", @"two", nil];
        NSEnumerator *e = [set1 objectEnumerator];
        NSString *s;
        while((s = [e nextObject]) != nil) {
            NSLog(@"%@", s);
        }
    

  

2-数组转集合

        NSArray *arr2 = @[@"one", @"one", @"two", @"tow"];
        NSSet *set = [NSSet setWithArray:arr2];
        NSLog(@"%@", set);

3-Map

     NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:@"IOS", @"1", @"Android", @"2", @"cocos2d-x", @"3", nil];
        NSLog(@"%@", dic);
        
        NSArray *keys = @[@"1", @"2", @"3", @"3"];
        NSArray *values = @[@"Android", @"iOS", @"cocos2dx", @"wp8"];
        NSDictionary *dc3 = [NSDictionary dictionaryWithObjects:values forKeys:keys];
        NSLog(@"%@", dc3);

 

  

OC和Java

标签:

原文地址:http://www.cnblogs.com/awebing/p/5657695.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!