標題LIST和set的區別## 標題
list:有序可重複,可動態擴容。
1、實現:arrayList,LinkedList;
2、ArrayList
1)底層實現:
數組―transient object[] elementdata;
(由於transient修飾的不能被序列化,
所以重寫了readObject和writeObject)
2)新增
a.動態擴容:添加時對對數組size++,
b. 採用Arrays.copyof(system.arraycopyof)
進行復制移動。
3、LinkedList
1)底層實現
雙向循環鏈表
2)新增
移動前後指針
set:
有序可重複。
底層實現:Map。
實現:HashSet(HashMap),TreeSet(TreeMap)