iphone - Can a NSDictionary take in NSSet as key? -


I know that you can use an object as the key for the NSDictionary but the problem is whether it receives the correct value Will be able to? Support I have an entry where the key = {1,3,5} and value = {@ "hello"}. Can I retrieve the set in {3,5,1} and retrieve it from this dictionary entry?

In order words, the key indicator is based on indicator or does it actually compare the content of the set? (And if this is the former, how can I remove it?)

Yes it is well Works from (Not sure if anyone is available)

  NSMutableDictionary * dict = [NSMutableDictionary dictionary]; NSAT * set; Set = [NSSet set with object: @ "A", @ "b", @ "c", @ "d", zero]; [Dict set object: @ "1" for: set]; Set = [NSSet set with object: @ "b", @ "c", @ "d", @ "e", nil]; [Dict setObject: @ "2" forKey: set]; ID key; NSEnumerator * enumerator = [dict keyEnumerator]; While ((key = [next object] [enumerator])) NSLog (@ "% @:% @", key, [dict octforforkey: key]); Set = [NSSet set with object: @ "c", @ "b", @ "e", @ "d", nil]; NSString * value = [dict itemForke: set]; NSLog (@ "Set:% @: key:% @", set, value);  

Output:

  2009-12-08 15:42 to 17.885 x [4989] (D, E, B, C): 2 2009- 12-08 15: 42: 17.887 X [49 9] (D, A, B, C): 1 2009-12-08 15:42, 17.887 x [4 9 8 9] Set: (D, E, B, C): Key: 2  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -