(2)美團試題:ArrayList和linkedlist有什麼區別,如何遍歷,使用for循環遍歷linkedlist爲什麼不行,linkedlist能使用索引訪問麼,使用迭代器呢

(一)ArrayList和linkedlist有什麼區別? 簡單的區別: 1.ArrayList是實現了基於動態數組的數據結構,LinkedList基於鏈表的數據結構。 (LinkedList是雙向鏈表,有next也有previous) 2.對於隨機訪問get和set,ArrayList覺得優於LinkedList,因爲LinkedList要移動指針。 3.對於新增和刪除操作add和remove,
相關文章
相關標籤/搜索