Skip navigation.
 
mlRe: Finding out if an NSArray's contents are all equal
FROM : Andre
DATE : Sat Jul 22 19:29:29 2006

Ashley Clark wrote:

> Check out isEqualToArray: in NSArray.

Thanks for the response. Yea, but its only for comparing arrays to 
arrays.

What I was looking for was if all objects in an array are equal to 
each other.
IOW, are each and every object containing the same equivalent value e.g
an array of NSNumbers all equalling 21.0 would return YES, else NO if 
the
contents' NSNumber objects varied in their value...

(Again, it seems apple hasn't a built-in method for this particular 
aspect...)

Andre

> On Jul 22, 2006, at 10:09 AM, <email_removed> wrote:
>

>> HI all,
>>
>> I have category method added to NSArray that checks to see if its 
>> contents are all equal.
>> Basically the method just performs isEqual: to each item in the 
>> array comparing it to the first item, and if none return NO, then 
>> I return YES.
>> Otherwise I return NO.
>>
>> What I'm wondering is, am I replicating any functionality in 
>> cocoa, that already exists? I'm curious if KVC cant be used to 
>> discover if an array
>> has all its objects the same value....
>>
>> I just want to make sure, though I've looked around, I don't want 
>> to maintain code that is already been done by apple...
>>
>> Thanks
>>
>> Andre
>> <email_removed>
>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list      (<email_removed>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>>
>> This email sent to <email_removed>
>>

>
> Ashley Clark
>
>

Related mailsAuthorDate
mlFinding out if an NSArray's contents are all equal listposter Jul 22, 17:09
mlRe: Finding out if an NSArray's contents are all equal Ashley Clark Jul 22, 19:12
mlRe: Finding out if an NSArray's contents are all equal Andre Jul 22, 19:29
mlRe: Finding out if an NSArray's contents are all equal Adam R. Maxwell Jul 22, 19:48
mlRe: Finding out if an NSArray's contents are all equal Andre Jul 22, 20:08
mlRe: Finding out if an NSArray's contents are all equal patrick machielse Jul 22, 21:25
mlRe: Finding out if an NSArray's contents are all equal Andre Jul 23, 00:53
mlRe: Finding out if an NSArray's contents are all equal patrick machielse Jul 23, 01:07
mlRe: Finding out if an NSArray's contents are all equal Andre Jul 23, 04:14
mlRe: Re: Finding out if an NSArray's contents are all equal Michael Ash Jul 23, 05:07