On 7 Apr '08, at 5:33 AM, Paul Sargent wrote:
Can anybody suggest a good way to:1) Given an ordered set of objects, create a new non-mutable ordered set,with all the duplicates removed?2) Given an ordered set of objects, create a new non-mutable ordered set, with each entry being the output of a method applied to each entry of theoriginal array (e.g. Python map())?
No, there's nothing like that built-in, unfortunately.
Are there any ObjC shortcuts when doing things like this? Am I best writing a category on top of NSArray the encompass these (and other) patterns? I'd like to retain ordering, so using NSSet for (1) seems counter productive.
Category methods would be a clean way to do it; just put a prefix on your method names so they won't conflict with any methods Apple adds in the future.
The only nontrivial thing about implementing these is performance, and that's only an issue if you work on huge arrays.
—Jens
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
