Re: Collection classes
Re: Collection classes
- Subject: Re: Collection classes
- From: Alexander Spohr <email@hidden>
- Date: Thu, 8 Jan 2004 15:37:07 +0100
timothy,
I am implementing a table data source. I have a class (Foo) that has
an
instance attribute (bar) of type NSMutableSet that I want to have the
table display. The contract of bar is that it not allow duplicates,
so it
HAS to be a NSSet*, as that is the only collection that enforces that
contract. The Cocoa data sources in Cocoa want collections that are
indexable, and I understand why.
use NSMutableArray and check for containsObject: before you insert.
i rember apple having a private method called -(BOOL)addObjectIfAbsent:
that was not in the headers of NSMutableArray. so before you add such a
method as a category, try to just create a header for it. if you can
use it fine (it's still in there somewhere) if you get
selectorNotRecognized just implement it yourself and you can use
NSMutableArray as an indexable list with unique entries.
atze
_______________________________________________
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.