Set: HashSet TreeSet
List: ArrayList LinkedList
Map: HashMap TreeMap
Java SDK不提供直接繼承自Collection的類,Java SDK提供的類都是繼承自Collection的“子接口”如List和Set。

亦

亦
創(chuàng)建方式:
Collection collection = new ArrayList();
迭代器:
Iterator it = collection.iterator(); // 獲得一個(gè)迭代子
while(it.hasNext()) {
Object obj = it.next(); // 得到下一個(gè)元素
}
常見方法:
add.clear.remove,toarray.
注意:
Linked 改快讀慢
Array 讀快改慢
Hash 兩都之間
hashset與treeset區(qū)別:
hash表與tree的不同實(shí)現(xiàn)。
hash用來(lái)存儲(chǔ)大量的值,tree用來(lái)排序
Collection是集合接口
|————Set子接口:無(wú)序,不允許重復(fù)。
|————List子接口:有序,可以有重復(fù)元素。
區(qū)別:Collections是集合類