是否有可能通过它的位置从HashMap中获取元素? [英] Is it possible to get element from HashMap by its position?
本文介绍了是否有可能通过它的位置从HashMap中获取元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从HashMap的位置检索元素,是否有可能?
解决方案
HashMaps 不会保留顺序:
这个类不保证
在 LinkedHashMap 中,它保证了可预测的迭代订单。
是地图的顺序;特别是
并不能保证订单
会随时间保持不变。How to retrieve an element from HashMap by its position, is it possible at all?
解决方案HashMaps do not preserve ordering:
This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.
Take a look at LinkedHashMap, which guarantees a predictable iteration order.
这篇关于是否有可能通过它的位置从HashMap中获取元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文