Instance Method

firstObjectCommonWithArray:

Returns the first object contained in the receiving array that’s equal to an object in another given array.

Declaration

- (ObjectType)firstObjectCommonWithArray:(NSArray<ObjectType> *)otherArray;

Parameters

otherArray

An array.

Return Value

Returns the first object contained in the receiving array that’s equal to an object in otherArray. If no such object is found, returns nil.

Discussion

This method uses isEqual: to check for object equality.

See Also

Comparing Arrays

- isEqualToArray:

Compares the receiving array to another array.