ArrayList和 LinkedList的区别

简述ArrayList和 LinkedList的区别

ArrayList和LinkedList的区别有以下几点:

  1. ArrayList是实现了基于动态数组的数据结构,而LinkedList是基于链表的数据结构;
  1. 对于随机访问get和set,ArrayList要优于LinkedList,因为LinkedList要移动指针;
  1. 对于添加和删除操作add和remove,一般大家都会说LinkedList要比ArrayList快,因为ArrayList要移动数据。但是实际情况并非这样,对于添加或删除,LinkedList和ArrayList并不能明确说明谁快谁慢

猜你喜欢

转载自blog.csdn.net/qq_40694640/article/details/112969158