Removing Entries From a Mutable Dictionary

suggest change

- removeObjectForKey:

Removes a given key and its associated value from the dictionary.

NSMutableDictionary *dict =  [NSMutableDictionary dictionaryWithDictionary:@{@"key1":@"Easy",@"key2": @"Tutorials"}];
[dict removeObjectForKey:@"key1"];
NSLog(@"%@",dict);
OUTPUT
{
    key2 = Tutorials;
}

- removeAllObjects

Empties the dictionary of its entries.

NSMutableDictionary *dict =  [NSMutableDictionary dictionaryWithDictionary:@{@"key1":@"Eezy",@"key2": @"Tutorials"}];
[dict removeAllObjects];
NSLog(@"%@",dict);
OUTPUT
{
}

- removeObjectsForKeys:

Removes from the dictionary entries specified by elements in a given array.

NSMutableDictionary *dict =  [NSMutableDictionary dictionaryWithDictionary:@{@"key1":@"Easy",@"key2": @"Tutorials"}];
[dict removeObjectsForKeys:@[@"key1"]];
NSLog(@"%@",dict);
OUTPUT
{
    key2 = Tutorials;
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


NSMutableDictionary:
*Removing Entries From a Mutable Dictionary

Table Of Contents