0

I am adding some key and values in NSMutableDictionary but while retrieving the allKeys that I am not getting the same order in that I was adding. Is there any way to get the same order or any other way to save the values.

Please note: I do not want to sort the array of allKeys. I want a specific order in which I added.

David Ansermot
  • 6,052
  • 8
  • 47
  • 82
Shruti
  • 1,849
  • 1
  • 13
  • 21
  • 2
    Dictionaries don't have an order. You need a separate array of keys as well as the dictionary. This question has been asked many times; please search before posting. – trojanfoe May 01 '15 at 06:26
  • 2
    You might want to have a think about how you got to this problem in the first place, and change your approach to whatever it is you are trying to do. –  May 01 '15 at 06:33
  • Are you sure you want an `NSMutableDictionary` and not an `NSMutableOrderedSet` – p0lAris May 01 '15 at 06:39
  • Or better, consider either having a parallel array or you may want to create your own composite object to do the right things. – uchuugaka May 01 '15 at 06:41

0 Answers0