The magic of TreeMap

Map in Android is often used, and everyone is accustomed to using HashMap. The difference between TreeMap and HashMap is that the former is an ordered sort, and the latter is an unordered sort. As in the following example, we can sort letters and the keys will be sorted automatically.

In addition, if you want to sort the HashMap, you can also use the sort() method.

 

 

 

Guess you like

Origin blog.csdn.net/chenluming210/article/details/130622931