• 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
Sorted arrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sorted arrays


  • Subject: Sorted arrays
  • From: Andy Bettis <email@hidden>
  • Date: Wed, 8 Jun 2005 15:37:23 +0100

Hello again,

I want to store a list of objects in a NSMutableArray, which will be kept sorted. How can I ensure that new items are inserted with the correct index? Assuming that there's no way of assigning a comparator to an array (which I can't find any reference to) is there a way of finding the index of where an object would be inserted according to the isEqual() message results?

Looking ahead, I want to be able to change the sorting criteria for my data, probably via a separate array which could also be a subset of the complete data set. This will make isEqual() a poor choice, as I don't want to implement the viewing criteria inside the model objects. Any advice? I'd rather not subclass NSMutableArray in my first Cocoa project!

Cheers

Rev. Andy



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Sorted arrays
      • From: Andy Lee <email@hidden>
  • Prev by Date: Re: universal binary compilation errors
  • Next by Date: Re: Spam:*****, Re: universal binary compilation errors
  • Previous by thread: Re: universal binary compilation errors
  • Next by thread: Re: Sorted arrays
  • Index(es):
    • Date
    • Thread