31@implementation NSDictionary (OOExtensions)
33- (NSDictionary *) dictionaryByAddingObject:(
id)object forKey:(
id)key
36 if (
object ==
nil || key ==
nil)
return [[
self copy] autorelease];
38 NSMutableDictionary *temp = [
self mutableCopy];
39 [temp setObject:object forKey:key];
40 NSDictionary *result = [[temp copy] autorelease];
47- (NSDictionary *) dictionaryByRemovingObjectForKey:(
id)key
50 if (key ==
nil)
return [[
self copy] autorelease];
52 NSMutableDictionary *temp = [
self mutableCopy];
53 [temp removeObjectForKey:key];
54 NSDictionary *result = [[temp copy] autorelease];
61- (NSDictionary *) dictionaryByAddingEntriesFromDictionary:(NSDictionary *)dictionary
64 if (dictionary ==
nil)
return [[
self copy] autorelease];
66 NSMutableDictionary *temp = [
self mutableCopy];
67 [temp addEntriesFromDictionary:dictionary];
68 NSDictionary *result = [[temp copy] autorelease];