I have a main NSMutableDictionary that contains a collection of other NSMutableDictionary.
It goes like this:
NSMutableDictionary *subDict1 = [NSMutableDictionary dictionaryWithObjectsAndKeys: obj1, @"name", obj2, @"color", nil]; NSMutableDictionary *subDict2 = [NSMutableDictionary dictionaryWithObjectsAndKeys: obj3, @"name", obj4, @"color", obj5, @"address", obj6, @"phone", obj7, @"color", obj8, @"parent", nil]; NSMutableDictionary *subDict3 = [NSMutableDictionary dictionaryWithObjectsAndKeys: obj0, @"name", obj9, @"parent", objA, @"site", objB, @"surname", objC, @"label", nil];
These auxiliary dictionaries may have a different number of entries, and the keys may be different. Some may have keys with the same name.
They are stored in the main dictionary, for example:
NSMutableDictionary *mainDict = [NSMutableDictionary dictionaryWithObjectsAndKeys: subDict1, @"1", subDict3, @"3", subDict2, @"2", nil];
I want to delete all entries in all sub dictionaries with a certain key in one picture.
I know that I can iterate over dictionaries and sub dictionaries, but I also know that dictionaries have smart ways to do this using predicates and other things, but I don't see how to do this. I am trying to find this because the method that will be executed is a little more complicated and should do it as quickly as possible, and I'm not sure if the normal iteration with loops or something else will be fast enough ...
Any clues? thanks.