本文介绍了有没有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. :)

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

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

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

09-05 13:06
查看更多