Objective-C Language NSDictionary Check if NSDictionary already has a key or not


Example

Objective c:

   //this is the dictionary you start with. 
 NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"name1", @"Sam",@"name2", @"Sanju",nil];

//check if the dictionary contains the key you are going to modify.  In this example, @"Sam"
if (dict[@"name1"] != nil) {
    //there is an entry for Key name1       
}
else {
    //There is no entry for name1       
}