PATH |
NSMutableDictionary
- Inherits from:
- NSDictionary : Object
- Implements:
- Cloneable
- java.io.Serializable
- NSCoding
- NSKeyValueCoding
- NSKeyValueCodingAdditions
- Package:
- com.webobjects.foundation
Class Description
The NSMutableDictionary class declares the programmatic interface to objects that manage mutable associations of keys and values. This class adds modification operations to the basic operations it inherits from NSDictionary.
Methods that add entries to NSMutableDictionaries-whether during construction or modification-add each value object to the dictionary directly. These methods also add each key object directly to the dictionary, which means that you must ensure that the keys do not change. If you expect your keys to change for any reason, you should make copies of the keys and add the copies to the dictionary.
Table 0-9 describes the NSMutableDictionary methods that provide the basis for all NSMutableDictionary's other methods; that is, all other methods are implemented in terms of these seven. If you create a subclass of NSMutableDictionary, you need only ensure that these base methods work properly. Having done so, you can be sure that all your subclass's inherited methods operate properly.
Method | Description |
count | Returns the number of entries in the dictionary. Inherited from NSDictionary. |
objectForKey | Returns the value associated with a given key. Inherited from NSDictionary. |
keysNoCopy | Returns a natural language array containing the keys in the dictionary. Inherited from NSDictionary. |
objectsNoCopy | Returns a natural language array containing the objects in the dictionary. Inherited from NSDictionary. |
removeAllObjects | Empties the dictionary of its entries. |
removeObjectForKey | Removes the specified key object and its associated value object from the dictionary. |
setObjectForKey | Adds or replaces an entry to the receiver consisting of the specified key and value objects. |
The other methods declared here provide convenient ways of adding or removing multiple entries at a time.
Interfaces Implemented
- Cloneable
- clone
- java.io.Serializable
- NSCoding
- classForCoder
- decodeObject
- encodeWithCoder
- NSKeyValueCoding
- takeValueForKey
- valueForKey
- NSKeyValueCodingAdditions
- takeValueForKeyPath
- valueForKeyPath
Method Types
- Constructors
- NSMutableDictionary
- Adding and removing entries
- addEntriesFromDictionary
- removeAllObjects
- removeObjectForKey
- removeObjectsForKeys
- setDictionary
- setObjectForKey
- Copying the dictionary
- immutableClone
- Methods inherited from Object
- clone
Constructors
NSMutableDictionary
public NSMutableDictionary()
public NSMutableDictionary(int capacity)
public NSMutableDictionary( NSArray objectArray, NSArray keyArray)
Note: NSMutableDictionary assumes that key objects are immutable. If your key objects are mutable, you should make copies of them and add the copies to the dictionary. |
public NSMutableDictionary(NSDictionary dictionary)
public NSMutableDictionary( Object object, Object key)
Note: NSMutableDictionary assumes that key objects are immutable. If your key objects are mutable, you should make copies of them and add the copies to the dictionary. |
public NSMutableDictionary( Object[] objects, Object[] keys)
Note: NSMutableDictionary assumes that key objects are immutable. If your key objects are mutable, you should make copies of them and add the copies to the dictionary. |
public NSMutableDictionary( java.util.Dictionary dictionary, boolean ignoreNull)
false
, throws an InvalidArgumentException if any key or value in dictionary is null
.
Instance Methods
addEntriesFromDictionary
public void addEntriesFromDictionary(NSDictionary otherDictionary)
See Also: setObjectForKey
clone
public Object clone()
immutableClone
public NSDictionary immutableClone()
mutableClone
public NSMutableArray mutableClone()
removeAllObjects
public void removeAllObjects()
See Also: removeObjectForKey, removeObjectsForKeys
removeObjectForKey
public Object removeObjectForKey(Object key)
null
.
See Also: removeObjectsForKeys, removeAllObjects
removeObjectsForKeys
public void removeObjectsForKeys(NSArray keyArray)
See Also: removeObjectForKey, removeAllObjects
setDictionary
public void setDictionary(NSDictionary otherDictionary)
setObjectForKey
public void setObjectForKey( Object anObject, Object aKey)
null
.Note: NSMutableDictionary assumes that key objects are immutable. If your key objects are mutable, you should make copies of them and add the copies to the dictionary. |
See Also: removeObjectForKey
takeValueForKey
public void takeValueForKey( Object value, String key)
null
. Otherwise invokes removeObjectForKey for the specified key.Note: NSMutableDictionary assumes that key objects are immutable. If your key objects are mutable, you should make copies of them and add the copies to the dictionary. |
© 2001 Apple Computer, Inc. (Last Published April 17, 2001)