Re: Obj-C idioms for list based tasks
Re: Obj-C idioms for list based tasks
- Subject: Re: Obj-C idioms for list based tasks
- From: William Turner <email@hidden>
- Date: Mon, 7 Apr 2008 08:44:41 -0700
On Apr 7, 2008, 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?
You could do this using the KVC set and array operators (http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html
):
NSArray *arr = [NSArray arrayWithObjects:@"A", @"A", @"B", @"B", @"C",
nil];
NSArray *arr2 = [arr valueForKeyPath:@"@distinctUnionOfObjects.self"];
- Wil
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden