Reputation: 26476
I have two NSArray
s each containing NSString
s. I need to test whether the two arrays are equal. In this instance, equality means not that the arrays contain the same objects, but that each object returns true for isEqualToString
when compared its counterpart. The arrays are also not equal if one contains more items than the other, or the order of the items is different.
Can I assume isEqualToArray
won't help me here?
Similarly, I don't see an approach using NSSet
that would fulfill all of the criteria.
How might I test the equality of these two arrays?
Upvotes: 3
Views: 1828
Reputation: 410632
The docs for isEqualToArray
state:
Two arrays have equal contents if they each hold the same number of objects and objects at a given index in each array satisfy the
isEqual:
test.
That seems like it fits your criteria.
Upvotes: 9