Reputation: 60244
I need just a collection of two pairs of data, none of them is going to be null. I don't need any sorting or other possibilities. What implementation of Map
should I choose?
Upvotes: 1
Views: 107
Reputation: 11906
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
Upvotes: 5