PATH  Documentation > Mac OS X > Foundation Reference: Java



Table of Contents

NSMutableDictionary


Inherits from:
NSDictionary : NSObject
Package:
com.apple.yellow.foundation

Class at a Glance


An NSDictionary object stores a mutable set of entries.

Principal Attributes


Creation



NSMutableDictionary Creates a new dictionary

Commonly Used Methods



removeObjectForKey Removes the specified entry from the dictionary.
removeObjectsForKeys Removes multiple entries from the dictionary.


Class Description


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.




Method Types


Constructors
NSMutableDictionary
Adding and removing entries
addEntriesFromDictionary
removeAllObjects
removeObjectForKey
removeObjectsForKeys
setDictionary
setObjectForKey


Constructors



NSMutableDictionary

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.




Instance Methods



addEntriesFromDictionary

public void addEntriesFromDictionary(NSDictionary otherDictionary)

Adds the entries from otherDictionary to the receiver. Each value object from otherDictionary is added directly to the receiver.

See Also: setObjectForKey



removeAllObjects

public void removeAllObjects()

Empties the dictionary of its entries.

See Also: removeObjectForKey, removeObjectsForKeys



removeObjectForKey

public void removeObjectForKey(Object aKey)

Removes aKey and its associated value object from the dictionary.

See Also: removeAllObjects, removeObjectsForKeys



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



setDictionary

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.



setObjectForKey

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 directly to the dictionary. Throws an InvalidArgumentException if the key or value object is null.

See Also: removeObjectForKey




Table of Contents