Created
February 17, 2014 03:57
-
-
Save azu/9044495 to your computer and use it in GitHub Desktop.
countしてsort
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
NSDictionary *dictionary = AZ_ASTCount( | |
@[@"a", @"d", @"d", @"a", @"d", @"c", @"b", @"c"], ^id <NSCopying>(NSString *obj) { | |
return obj; | |
}); | |
NSArray *orderedKeys = [dictionary keysSortedByValueUsingComparator:^NSComparisonResult(id obj1, id obj2) { | |
return [obj1 compare:obj2]; | |
}]; | |
NSLog(@"dictionary = %@", orderedKeys); | |
/* | |
dictionary = ( | |
b, | |
c, | |
a, | |
d | |
) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment