NSDictionary — Mac OS X 10.0
This class manages a collection of objects as
pairs: objects are identified by a unique key within the dictionary.
A key-value pair within a dictionary is called an entry.
NSDictionary is an immutable class whose contents
cannot be altered after they have been initially set. If you need a
mutable dictionary, use
instead. A dictionary key is typically an
NSString, but according to the API the key can be
any object that is type
id. The fact that a key
can be an object of any type opens the way for interesting design
possibilities in Cocoa.
NSDictionary has three primitive methods upon
which the rest of the API is based. They are
returns the number of objects contained in the dictionary. The method
objectForKey: is used to access an object in the
keyEnumerator will return an
NSEnumerator object that will enumerate the keys
of the dictionary. In addition to
NSDictionary responds to
objectEnumerator for enumerating the contents of
the dictionary. Note that there is no order in a dictionary as there
is in an array. When enumerating the contents of a dictionary, there
is no guarantee regarding the order that member objects will be
returned by the enumerator.
Often we want to send a message to each member of a collection.
NSDictionary provides a method that save us from the burden of having to enumerate the contents of the dictionary ...