Stephen Hsu Stephen Hsu - 5 months ago 11
Objective-C Question

To create an empty dictionary, [NSMutableDictionary dictionary] or [[NSMutableDictionary alloc] init]?

To create an empty dictionary, should I call

[NSMutableDictionary dictionary]
or
[[NSMutableDictionary alloc] init]
?

What's the difference?

Answer

[NSMutableDictionary dictionary] is the same as [[[NSMutableDictionary alloc] init] autorelease]