Hashmap和Hashtable 都不是有序的。
TreeMap和LinkedHashmap都是有序的。

TreeMap实现有序的原理:
图片说明

LinkedHashmap实现有序的原理:
图片说明

不过,话说一个map实现有序有什么用?