What is the difference between these two NSArray methods?
indexOfObjectIdenticalTo checks for the exact same id (same address). indexOfObject checks that isEqual: returns YES.
The first uses isEqual: to find a matching object, while the second looks for the same object (i.e., the object at the same memory location).
indexOfObjectIdenticalTo is far more faster than indexOfObject but it uses pointer comparison == instead of calling isEqual:
If you are searching for a pointer match, always use indexOfObjectIdenticalTo to get peak performance
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With