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(); // 獲得一個迭代子
while(it.hasNext()) {
Object obj = it.next(); // 得到下一個元素
}
常見方法:
add.clear.remove,toarray.
注意:
Linked 改快讀慢
Array 讀快改慢
Hash 兩都之間
hashset與treeset區(qū)別:
hash表與tree的不同實現(xiàn)。
hash用來存儲大量的值烤黍,tree用來排序
Collection是集合接口
|————Set子接口:無序,不允許重復(fù)汤功。
|————List子接口:有序杂曲,可以有重復(fù)元素。
區(qū)別:Collections是集合類