Adding objects to NSMutableArray out of order?

2009-05-04 Thread Colin Cornaby
I'm dealing with some code that returns results out of order, but the results contain the proper index. In the end, I'd like to put them all into an NSArray, but unlike a C array, NSArray doesn't seem to allow me to simply reserve X number of slots and fill the slots as the results come

Re: Adding objects to NSMutableArray out of order?

2009-05-04 Thread Chris Suter
Hi Colin, On Tue, May 5, 2009 at 9:50 AM, Colin Cornaby co...@consonancesw.com wrote: I'm dealing with some code that returns results out of order, but the results contain the proper index. In the end, I'd like to put them all into an NSArray, but unlike a C array, NSArray doesn't seem to

Re: Adding objects to NSMutableArray out of order?

2009-05-04 Thread Greg Parker
On May 4, 2009, at 4:50 PM, Colin Cornaby wrote: I'm dealing with some code that returns results out of order, but the results contain the proper index. In the end, I'd like to put them all into an NSArray, but unlike a C array, NSArray doesn't seem to allow me to simply reserve X number of

Re: Adding objects to NSMutableArray out of order?

2009-05-04 Thread Jonathan Hess
Hey Colin - It sounds like you are going to get results 1-n, out of order, here's what I would do: - (void)start { myArray = [[NSMutableArray alloc] init]; for(NSInteger idx = 0; idx = n; idx += 1) { [myArray addObject:[NSNull null]]; } } - (void)processResult:(id)result

Re: Adding objects to NSMutableArray out of order?

2009-05-04 Thread Graham Cox
On 05/05/2009, at 9:50 AM, Colin Cornaby wrote: I'm dealing with some code that returns results out of order, but the results contain the proper index. In the end, I'd like to put them all into an NSArray, but unlike a C array, NSArray doesn't seem to allow me to simply reserve X number