Created
July 11, 2012 03:13
-
-
Save b-adams/3087753 to your computer and use it in GitHub Desktop.
Objective-C test snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// unionSet respects counted set counts | |
#import <Foundation/Foundation.h> | |
int main (int argc, const char * argv[]) | |
{ | |
@autoreleasepool { | |
NSCountedSet* cSet = [NSCountedSet set]; | |
[cSet addObject:@"Yo"]; | |
id obj = @"Ho"; | |
[cSet addObject:obj]; | |
[cSet addObject:obj]; | |
[cSet addObject:@"Bottle of Rum"]; | |
NSLog(@"Pre-union %@", cSet); | |
NSSet* set = [NSSet setWithObjects:@"Hi", @"Hi", obj, @"Hum", nil]; | |
[cSet unionSet:set]; | |
NSLog(@"Post-union %@", cSet); | |
[cSet unionSet:cSet]; | |
NSLog(@"Post self-union: %@", cSet); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment