NSMutableDictionary of NSMutableSets... sorting this out
Posted
by Mike
on Stack Overflow
See other posts from Stack Overflow
or by Mike
Published on 2010-03-17T07:43:26Z
Indexed on
2010/03/17
7:51 UTC
Read the original article
Hit count: 449
I have a NSMutableDictionary of NSMutableSets.
Each set entry is a string, something like this:
NSMutableSet *mySet = [NSMutableSet setWithObjects:
[NSString stringWithFormat:@"%d", time1],
[NSString stringWithFormat:@"%d", time2],
[NSString stringWithFormat:@"%d", time3],
nil];
// time 1,2,3, are NSTimeInterval variables
then I store each set on the dictionary using this:
NSString *rightNowString = [NSString stringWithFormat:@"%d", rightNow];
[myDict setValue:mySet forKey:rightNow];
// rightNow is NSTimeInterval
as rightNow key can occur out of order, I end with a NSDictionary that is not ordered by rightNow.
How can I sort this NSDictionary by its keys considering that they are numbers stored as strings on the dictionary...?
I don't care for ordering the sets, just the dictionary.
thanks for any help.
© Stack Overflow or respective owner