Are there any ordered containers such as C++ STL map, set in Objective-C, or am I supposed to reinvent the wheel?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
NSArray is an ordered container. If you’re looking for an ordered map, no, it doesn’t have that. A common solution is to use a normal NSDictionary and track ordering with either an array (if the ordering is arbitrary) or an NSSortDescriptor (if the ordering is based on something intrinsic to the objects).