What I want to do, is create an NSMutableSet, the purpose of which would be to count how many pairs of unique data there are.
Basically, I have two mutable arrays; xCoordinates and yCoordinates, and a custom object called XYPoint. 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 xCoordinates array, the number 4 and in the yCoordinates array, the number 8, making the point (4, 8).
Now, to the crux of the question, what I want to do is check how many unique points are there. I was planning on using an NSMutableSet to do it. I.e:
for (int i = 0; i < [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];
        }
    }
Unfortunately, that doesn't work. Is there a way to say;
if (there isn't an object in the set with an identical X coordinate property and Y coordinate property){
    Add one to the set;
}
?
 
     
     
     
     
    