Other way is to iterate through both arrays and compare each object using isEqual: method. It is the same to calling isEqualToArray:. Note that in both variants you should implement isEqual: method in your array object class if it in not a standard class.
And right before this operations you can just compare their length, if they are not equal so there is no point of spending resources on more complicated calculations.
Should be able to use the
NSArray
base class to compare one array with another array:returns
YES
if arrays are equal else returnsNO
Use isEqualToArray: method to compare between two array object
like this :
Method 1:
Method 2:
Does
isEqualToArray:
method help you?Other way is to iterate through both arrays and compare each object using
isEqual:
method. It is the same to callingisEqualToArray:
. Note that in both variants you should implementisEqual:
method in your array object class if it in not a standard class.And right before this operations you can just compare their length, if they are not equal so there is no point of spending resources on more complicated calculations.