• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problem with NSSet's containsObject: and member: methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Problem with NSSet's containsObject: and member: methods
      • From: Chris Kane <email@hidden>
  • Prev by Date: Re: Columns with diminishing number of rows?
  • Next by Date: Re: WebCore revisted
  • Previous by thread: Re: Vending Objects in DO
  • Next by thread: Re: Problem with NSSet's containsObject: and member: methods
  • Index(es):
    • Date
    • Thread