title: Checking whether a mutable set contains an object with identical properties
body: <p>What I want to do, is create an <code>NSMutableSet</code>, the purpose of which would be to count how many pairs of unique data there are.</p>
  
  <p>Basically, I have two mutable arrays; <code>xCoordinates</code> and <code>yCoordinates</code>, and a custom object called <code>XYPoint</code>. Each X coordinate and Y coordinate at coinciding indices combine to make a point on a cartesian plane. For example, at index 2, there may be in the <code>xCoordinates</code> array, the number 4 and in the <code>yCoordinates</code> array, the number 8, making the point (4, 8).</p>
  
  <p>Now, to the crux of the question, what I want to do is check how many <em>unique</em> points are there. I was planning on using an <code>NSMutableSet</code> to do it. I.e:</p>
  
  <pre><code>for (int i = 0; i &lt; [xCoordinates count]; i++) {
  
          XYPoint *newXY = [[XYPoint alloc] init];
          newXY.xCoordinate = [xCoordinates objectAtIndex:i];
          newXY.yCoordinate = [yCoordinates objectAtIndex:i];
  
          if ([distinct containsObject:newXY] == NO) {
  
              [distinct addObject:newXY];
  
          }
  
      }
  </code></pre>
  
  <p>Unfortunately, that doesn't work. Is there a way to say;</p>
  
  <pre><code>if (there isn't an object in the set with an identical X coordinate property and Y coordinate property){
  
      Add one to the set;
  
  }
  </code></pre>
  
  <p>?</p>