是否有任何HashMap实现在程序运行之间具有一致的顺序? [英] Are there any HashMap implementations with consistent ordering between program runs?

查看:99
本文介绍了是否有任何HashMap实现在程序运行之间具有一致的顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我观察到,即使在下一个程序启动时具有相同的数据,HashMap的元素顺序也不同.看起来HashMap使用一些绝对地址来对元素进行排序.是否还有其他HashMap实现,如果插入了相同的数据,它的行为也相同?

I've observed that HashMap has a different order of elements even with the same data on the next program start. It looks like HashMap uses some absolute addresses to sort elements. Is there any other HashMap implementation, which has the same behaviour if the same data was inserted?

推荐答案

我相信已链接-hash-map 是事实上的箱子.

I believe linked-hash-map is the de facto crate for this.

这篇关于是否有任何HashMap实现在程序运行之间具有一致的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆