Instance Method

initWithCapacity:

Initializes a newly allocated mutable dictionary, allocating enough memory to hold numItems entries.

Declaration

- (instancetype)initWithCapacity:(NSUInteger)numItems;

Parameters

numItems

The initial capacity of the initialized dictionary.

Return Value

An initialized mutable dictionary, which might be different than the original receiver.

Discussion

Mutable dictionaries allocate additional memory as needed, so numItems simply establishes the object’s initial capacity.

This method is a designated initializer of NSMutableDictionary.

See Also

Creating and Initializing a Mutable Dictionary

+ dictionaryWithCapacity:

Creates and returns a mutable dictionary, initially giving it enough allocated memory to hold a given number of entries.

- init

Initializes a newly allocated mutable dictionary.

+ dictionaryWithSharedKeySet:

Creates a mutable dictionary which is optimized for dealing with a known set of keys.