How to keep the order of elements in hashtable

前端 未结 5 1156
庸人自扰
庸人自扰 2020-12-06 09:51

I have a hashtable . values() method returns values in some order different from the order in which i am inserted.How can i get the values in the same order as i inserted?Us

5条回答
  •  抹茶落季
    2020-12-06 10:14

    A hash table is inherently unordered, so you are using the wrong data structure. Since you don't specify what language you are using I cannot suggest an alternate, but you need some type of ordered key/value set.

提交回复
热议问题