HashTables/HashMaps are one of the most (if not the most) useful of data-structures in existence. As such, one of the first things I investigated when starting to learn programming in Cocoa was how to create, populate, and read data from a hashtable.
To my surprise: all the documentation I've been reading on Cocoa/Objective-C programming doesn't seem to explain this much at all. As a Java developer that uses "java.util" as if it were a bodily function: I am utterly baffled by this.
So, if someone could provide me with a primer for creating, populating, and reading the contents of a hashtable: I would greatly appreciate it.
NSDictionary and NSMutableDictionary?
And here's a simple example:
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init]; [dictionary setObject:anObj forKey:@"foo"]; [dictionary objectForKey:@"foo"]; [dictionary removeObjectForKey:@"foo"]; [dictionary release];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With