SergiusGee SergiusGee - 4 months ago 8
Objective-C Question

NSMutableArray check object at specific index

I have got an NSMutableArray before adding values to which I check if it's already there and I put this value at index 0.
However, if the value is already there, I would like to know it's there at the specific index.
This code doesn't work:

if ([theQueueArray containsObject:elementName atIndex:0])

How do you do it right, then?


Checking if an array "contains" an item at a specific index just sounds like a fancy way of stating the general case of accessing any item from an array at a given index, no?

if ([[theQueueArray objectAtIndex:0] isEqual:elementName]) {
    // ...

(If this isn't what you mean, consider clarifying the question.)