如何有效地遍历Java Map中的每个条目?

我们两清 提交于 2020-08-04 09:11:36

问题:

If I have an object implementing the Map interface in Java and I wish to iterate over every pair contained within it, what is the most efficient way of going through the map? 如果我有一个用Java实现Map接口的对象,并且希望对其中包含的每一对进行迭代,那么遍历该映射的最有效方法是什么?

Will the ordering of elements depend on the specific map implementation that I have for the interface? 元素的顺序是否取决于我对接口的特定映射实现?


解决方案:

参考一: https://stackoom.com/question/CCQ/如何有效地遍历Java-Map中的每个条目
参考二: https://oldbug.net/q/CCQ/How-do-I-efficiently-iterate-over-each-entry-in-a-Java-Map
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!