Sorted arrays
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