我只需要两对数据的集合,它们都不会为空。我不需要任何排序或其他可能性。我应该选择哪种 Map
实现方式?
最佳答案
The three general-purpose Map implementations are HashMap, TreeMap and LinkedHashMap. If you need SortedMap operations or key-ordered Collection-view iteration, use TreeMap; if you want maximum speed and don't care about iteration order, use HashMap; if you want near-HashMap performance and insertion-order iteration, use LinkedHashMap. In this respect, the situation for Map is analogous to Set. Likewise, everything else in the Set Implementations section also applies to Map implementations
关于java - 我应该选择什么 Collection ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5052137/