ArrayList和LinkedList区别
2018-04-14 本文已影响0人
叫我小码哥
相同点:
ArrayList和LinkedList这两个类都属于list接口下面的实现类。
不同点:
ArrayList是基于动态数组,LinkedList是基于链表的数据结构。
对于随机get和setArrayList的效率高于LinkedList,因为LinkedList要移动指针。
对于新增和删除add和remove,LinkedList的速度要高于ArrayList,因为ArrayList要移动元素。