Skip to content

Instantly share code, notes, and snippets.

@frr149
Created April 15, 2015 10:30
Show Gist options
  • Save frr149/8fddf5e3fea5755ec530 to your computer and use it in GitHub Desktop.
Save frr149/8fddf5e3fea5755ec530 to your computer and use it in GitHub Desktop.
// NSSet
NSMutableSet *fraseChorras = [NSMutableSet set];
[fraseChorras addObject:@"Tengo un cimbel matutino"];
[fraseChorras addObject:@"Con la forma de un pepino"];
[fraseChorras addObject:@"Tengo un cimbel matutino"]; // no se añade
NSLog(@"El conjunto: %@", fraseChorras);
// NSCountSet
NSCountedSet *bag = [NSCountedSet set];
[bag addObject:@"Tengo un cimbel matutino"];
[bag addObject:@"Con la forma de un pepino"];
[bag addObject:@"Tengo un cimbel matutino"]; // se suma a su contador
NSLog(@"En el saco hay: %@", bag);
NSLog(@"Número de cimbeles: %lu", [bag countForObject:@"Tengo un cimbel matutino"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment