What is the best way to properly test object equality against an array of objects?
<p>My objective is to abort the NSXMLParser when I parse an item that already exists in cache.  The basic flow of the program works like this:</p>

<p>1) Program starts and downloads an XML feed. Each item in the feed is represented by a custom object (FeedItem).  Each FeedItem gets added to an array.</p>

<p>2) When the parsing is complete the contents of the array (all FeedItem objects) are archived to the disk.</p>

<p>The next time the program is executed or the feed is refreshed by the user I begin parsing again; however, since a cache (array) now exists as each item is parsed I want to see if the object exists in the cache. If it does then I know I have downloaded all the new items and no longer need to continue parsing.</p>

<p>What I am learning, I think, is that I can't use indexOfObject or indexOfObjectIDenticalTo: because these really seem to be checking to see that the objects are using the same memory address (thus identical).</p>

<p>What I want to do is see if the contents of the object are equal (or at least some of the contents).  I've done some research and found that I can override the IsEqual method; however, I really don't want to iterate/enumerate through the entire cache contents table for every newly parsed XML FeedItem.  Is iterating through the collection and testing each one for equality the only way to do this or is there a better technique I am not aware of?</p>

<p>Currently I am using the following code though I know it needs to change:<br>
    NSUInteger index = [self.feedListCache.feedList indexOfObject:self.currentFeedItem];
    if (index == NSNotFound) {
    }</p>
