Why is there no queue in Cocoa?

cocoa, cocoa-touch, data-structures, queue

Solution

I've seen some people suggesting the use of `NSMutableArray`, but this is extremely inefficient for pops/dequeues, because it requires removing the object at index 0. That will shift all of the elements down (towards the now empty entry), thus taking O(n) time for each remove operation.

This is incorrect. `NSMutableArray` handles head insertion very efficiently and can be used for a number of different data structures, including queues and stacks.

Problem

I recently found out that there is no queue built into Cocoa (Touch, in this case). Why not? A queue is one of the most fundamental data structures in computer programming. I've seen some people suggesting the use of `NSMutableArray`, but this is extremely inefficient for pops/dequeues, because it requires removing the object at index 0. That will shift all of the elements down (towards the now empty entry), thus taking O(n) time for each remove operation. Am I missing something or was there just no reason that queues were not added to Cocoa?

Original source