Problem with NSSet's containsObject: and member: methods
Problem with NSSet's containsObject: and member: methods
- Subject: Problem with NSSet's containsObject: and member: methods
- From: Thomas Deniau <email@hidden>
- Date: Fri, 11 Apr 2003 14:03:51 +0200
Hi !
I've a NSMutableSet of custom objects of class A.
I've overridden isEqual: in A and I NSLog() whenever the method is called.
Suppose the set has three elements b, c, d of class A, and we have a given
object e of class A. [d isEqual:e] returns TRUE, and [b isEqual:e],[c
isEqual:e] return FALSE.
When I call [set containsObject:e] or [set member:e] I get FALSE and nil (I
would have expected TRUE !).
I thought that the set would call isEqual: on each member until it finds a
corresponding object... But when I call member:e or containsObject:e I get
only one NSLog : the set calls [b isEqual:e], gets FALSE, and... stops
there. It does not call isEqual: on c and d.
When I NSLog() the set I get <NSCFSet: 0x156ed80> (b,c,d)
So the set only tries its 'first' element (the one returned by anyObject)
Why does it skip objects c and d ?
Thanks in advance,
--
Thomas Deniau
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.