I have NSArray and I want to remove duplicates from it. I know that using this method
[NSSet setWithArray:[arrAllValues valueForKey:@”value”]]
I also know that it invokes method specified in valueForKey parameter. But I don’t know what method NSSet invokes to compare objects in array.
My problem is that I want to compare property named “value”, but I want to return array of the object that contains the property and not the property. Can I do that?
Thanks !!!
It compares them using the NSObject protocol reference method:
therefore, you can override this method in your class to implement the desired behavior, as a note just like you would do it in Java, you should also override hash.