How does [array containsObject:id] method works? whether is it compare with addresses or is it compare the given objects properties with the array elements properties ?
How does [array containsObject:id] method works? whether is it compare with addresses or is
Share
Did you first try looking at the documentation for this method?
And from the
isEqual:method:What we can take from this is, unless you’re comparing two objects of predefined types (e.g.
NSArray,NSString) where there is already a system-described way of hashing the object’s contents and comparing the hashes, you need to provide a- (NSUInteger)hashmethod which returns an unsigned integer whose value, for objects you consider equal, will be equal.