Inherits from: NSDictionary : NSObject
Implements: NSCoding NSCopying NSMutableCopying (NSDictionary) NSObject (NSObject)
Package: com.apple.yellow.foundation
An NSDictionary object stores a mutable set of entries.
NSMutableDictionary | Creates a new dictionary |
removeObjectForKey | Removes the specified entry from the dictionary. |
removeObjectsForKeys | Removes multiple entries from the dictionary. |
The NSMutableDictionary class declares the programmatic interface to objects that manage mutable associations of keys and values. With its two efficient primitive methods- setObjectForKey and removeObjectForKey-this class adds modification operations to the basic operations it inherits from NSDictionary.
The other methods declared here operate by invoking one or both of these primitives. The non-primitive methods provide convenient ways of adding or removing multiple entries at a time.
- Constructors
- NSMutableDictionary
- Adding and removing entries
- addEntriesFromDictionary
- removeAllObjects
- removeObjectForKey
- removeObjectsForKeys
- setDictionary
- setObjectForKey
public NSMutableDictionary()
Creates and returns an empty mutable dictionary.
public NSMutableDictionary(NSDictionary otherDictionary)
Creates a mutable dictionary containing the keys and values found in otherDictionary.
public void addEntriesFromDictionary(NSDictionary otherDictionary)
Adds the entries from otherDictionary to the receiver. Each value object from otherDictionary is added directly to the receiver. In contrast, each key object is copied (keys must implement to the NSCopying interface), and the copy is added to the receiver.
See Also: setObjectForKey
public void removeAllObjects()
Empties the dictionary of its entries.
See Also: removeObjectForKey, removeObjectsForKeys
public void removeObjectForKey(Object aKey)
Removes aKey and its associated value object from the dictionary.
See Also: removeAllObjects, removeObjectsForKeys
public void removeObjectsForKeys(NSArray keyArray)
Removes one or more entries from the receiver. The entries are identified by the keys in keyArray.
See Also: removeObjectForKey, removeObjectForKey
public void setDictionary(NSDictionary otherDictionary)
Sets the receiver to entries in otherDictionary. setDictionary does this by removing all entries from the receiver (with removeAllObjects) then adding each entry from otherDictionary into the receiver.
public void setObjectForKey(Object anObject, Object aKey)
Adds an entry to the receiver, consisting
of aKey and its corresponding value object anObject.
The value object is added directory to the dictionary. In contrast, the
key is copied (keys must conform to the NSCopying protocol), and
the copy is added to the dictionary. Throws an NSInvalidArgumentException
if the key or value object is null
.
See Also: removeObjectForKey