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: Jake Carter <email@hidden>
- Date: Mon, 7 Apr 2008 09:16:40 -0700
You may also want to look in to NSPredicate and an arrays
'filteredArrayUsingPredicate:' method.
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSPredicate_Class/Reference/NSPredicate.html
http://theocacao.com/document.page/346
http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/predicates.html
:// Jake
On Apr 7, 2008, at 8:44 AM, William Turner wrote:
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
_______________________________________________
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