Re: Queue of NSStrings
Re: Queue of NSStrings
- Subject: Re: Queue of NSStrings
- From: Nicko van Someren <email@hidden>
- Date: Wed, 30 Mar 2005 11:59:43 +0100
On 30 Mar 2005, at 11:46, Adam wrote:
I need a queue of NSStrings in my Obj-C/Cocoa application. What is the
easiest way to implement this? Do I have to write my own, or does a
data structure already exists?
There's no FIFO or stack structures in Objective-C as such but they are
trivial to implement. For a queue/FIFO just use an NSMutableArray, add
things with addObject: and remove them, with objectAtIndex:0 followed
by removeObjectAtIndex:0 Unless you have a vast number of objects
you'll likely never notice that it has to memcpy the stack down one
word when you remove the items.
Nicko
_______________________________________________
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