I want to use a queue data structure in my Objective-C program. In C++ I'd use the STL queue. What is the equivalent data structure in Objective-C? How do I push/pop items?
Objective-c – How to make and use a Queue in Objective-C
cocoadata-structuresobjective-cqueue
Related Question
- Python – the difference between Python’s list methods append and extend
- What are the lesser known but useful data structures
- Ios – Constants in Objective-C
- Ios – How to sort an NSMutableArray with custom objects in it
- Javascript – How to implement a Stack and a Queue in JavaScript
- Ios – Passing data between view controllers
- Python – How to remove a key from a Python dictionary
Best Solution
Ben's version is a stack instead of a queue, so i tweaked it a bit:
NSMutableArray+QueueAdditions.h
NSMutableArray+QueueAdditions.m
Just import the .h file wherever you want to use your new methods, and call them like you would any other NSMutableArray methods.
Good luck and Keep on Coding!