Take the code below:
NSPredicate *predicateSource = [NSPredicate predicateWithFormat:@"SELF = %d",5];
NSArray *filteredArraySource = [[[self.myArray copy]autorelease] filteredArrayUsingPredicate:predicateSource];
myArray (NSMutableArray) contains 100 integers (numbers 1-100 in random order). What I'd like to do is somehow find out which index contains the number 5 without looping through each object in the array. The above code only extracts the object and places it into an array.
Any suggestions?
NSArrayis opaque, but seems to be a front-end for a hash table: ridiculousfish.com/blog/posts/array.html