• 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
Re: Obj-C idioms for list based tasks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Obj-C idioms for list based tasks
      • From: Jake Carter <email@hidden>
References: 
 >Obj-C idioms for list based tasks (From: "Paul Sargent" <email@hidden>)

  • Prev by Date: [Meeting] Chicago CocoaHeads / Cawug - MacRuby
  • Next by Date: IB outlets and NSCollectionViews
  • Previous by thread: Re: Obj-C idioms for list based tasks
  • Next by thread: Re: Obj-C idioms for list based tasks
  • Index(es):
    • Date
    • Thread