ArrayList和LinkedList區別 java

alexanderkenndy發表於2014-07-31

ArrayList與LinkedList 都是實現了List介面的集合類

1.資料結構:ArrayList 的底層實現是動態陣列,而LinkedList的底層實現是一個雙向連結串列。

2.隨機訪問:對於List介面的get set方法實現,ArrayList要優與LinkedList,因為ArrayList只根據下標取資料即可,而LinkedList要移動指標。

3.新增刪除:對於List介面的add remove 方法實現,LinkedList 要優於ArrayList,因為ArrayList要移動資料。

相關文章