during the interview, the interviewer told me that the performance of TreeMap was not good. Could you switch to another one?
at that time, I thought he was fooling me, but now I still haven"t found an orderly map with better performance!
during the interview, the interviewer told me that the performance of TreeMap was not good. Could you switch to another one?
at that time, I thought he was fooling me, but now I still haven"t found an orderly map with better performance!
this question feels a little strange. Ordering and map's put and get are two different operations. I don't quite understand whether the performance is put, get or something else. The characteristic of
TreeMap is that the Key is ordered (the order depends on the comparator of the key), the key is also ordered for put and get whose complexity is log (n)
LinkedHashMap (the order depends on the insertion order), and the complexity is 1