结构上:

   ArrayList使用了数组进行实现。

   LinkedList使用了循环双向链表数据结构进行实现。

浅谈ArrayList和LinkedList的使用情况

 

使用上:

ArrayList和LinkedList都是实现了List接口的容器类,用于存储一系列的对象引用。它们都可以对元素进行增、删、改、查操作。

但对元素的增删查操作的时候,查操作时用ArrayList 性能更佳,进行增删操作的时候最好用LinkedList 性能更佳

 

因为:对于随机访问的get和set方法,ArrayList要优于LinkedList,因为LinkedList要移动指针。

            对于新增和删除操作add和remove,LinkedList比较占优势,因为ArrayList要移动数据。

相关文章:

  • 2022-12-23
  • 2021-09-27
  • 2021-06-04
  • 2021-07-28
猜你喜欢
  • 2021-06-18
  • 2022-12-23
  • 2022-01-25
  • 2022-01-04
  • 2021-06-13
  • 2021-08-07
  • 2021-11-27
相关资源
相似解决方案