HashMap LinkedHashMap TreeMap

HashMap:

1:遍历时候,取出来的数据是随机的;

2:最多只允许一个key为Null,允许多个value为Null;

3:不支持线程的同步。

ps:如果需要支持多线程,使用Collections的synchronizedMap方法使HashMap具有同步的能力。或者直接使用concurrentHashMap。

 

LinkedHashMap:

1:遍历时候,取出来的数据是插入的顺序;

TreeMap:

1:遍历时候,取出来的数据是进行默认排序过的;

posted @ 2017-05-24 18:56  ゞ清茶℡  阅读(128)  评论(0)    收藏  举报