Well, I would implement it that way.
Subclass NSDictionary and execute the following methods:
- (BOOL)isEqual:(id)object; - (NSUInteger)hash;
It is very important that you implement the hash correctly. It should return different values ββfor different dictionaries, even if they are equal according to your definition. In isEqual, you can check if both dictionaries contain the same keys and the same values. If yes, return YES, otherwise return NO.
With this, your check later will be only one line: [arrayOfDictionaries containsObject:dictionaryIAmLookingFor];
If you implement the hash incorrectly or do not implement it, containsObject will not execute isEqual for all objects in the array.
source share