Class NSDictionary

An dictionary is like an array, except that the subscripts can be strings instead of dour NSUIntegers. It’s strange that the column of keys comes to the right of the column of values.

There is no guarantee that the loop will visit the elements in the original order.

Source code in Dictionary.zip

  1. main.m
2014-06-09 07:05:17.469 Dictionary[1112:60b] me is name I call myself

2014-06-09 07:05:17.531 Dictionary[1112:60b] me, a name I call myself
2014-06-09 07:05:17.532 Dictionary[1112:60b] sew, a needle pulling thread
2014-06-09 07:05:17.533 Dictionary[1112:60b] doe, a deer, a female deer
2014-06-09 07:05:17.534 Dictionary[1112:60b] ti, a drink with jam and bread
2014-06-09 07:05:17.535 Dictionary[1112:60b] ray, a drop of golden sun
2014-06-09 07:05:17.535 Dictionary[1112:60b] la, a note to follow sol
2014-06-09 07:05:17.536 Dictionary[1112:60b] far, a long, long way to run
2014-06-09 07:05:18.643 Dictionary[1112:60b] Application windows are expected to have a root view controller at the end of application launch

Things to try

  1. Make a mutable dictionary.
    	NSMutableDictionary *d = [[NSMutableDictionary alloc] init]; //born empty
    	[d setValue: @"deer, a female deer"      forKey: @"doe"];
    	[d setValue: @"drop of golden sun"       forKey: @"ray"];
    	[d setValue: @"name I call myself"       forKey: @"me"];
    	[d setValue: @"long, long way to run"    forKey: @"far"];
    	[d setValue: @"needle pulling thread"    forKey: @"sew"];
    	[d setValue: @"note to follow sol"       forKey: @"la"];
    	[d setValue: @"drink with jam and bread" forKey: @"ti"];
    	//Do not add nil at the end.
    

  2. Make a dictionary that translates from IKEA language to English. For example, LUDVIK means workstation and LEKSVIK means “wooden crib”. Write the IKEA word in the right column of the dictionary, and the English translation in the left column. Oldthinkers unbellyfeel Ingsoc.