有没有ArraySet和ArrayMap这样的东西? [英] Is there such thing as an ArraySet and ArrayMap?

查看:126
本文介绍了有没有ArraySet和ArrayMap这样的东西?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有这样的话,我想要一张保留元素顺序的地图。

I would like a map that preserves the order of the elements if there is such a thing.

我知道它会在HashMap附近执行,但我只计划将它用于小型/临时程序。

I am aware that it would not perform near as well as a HashMap, but I only plan to use it for small/temporary programs.

推荐答案

没有ArrayMap 。 :)

There's no ArrayMap. :)

LinkedHashMap 将保留插入顺序,并且 TreeMap 将根据键的自然顺序进行排序。

But a LinkedHashMap will preserve the insertion order, and a TreeMap will order based on the keys' natural ordering.

这篇关于有没有ArraySet和ArrayMap这样的东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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