Basically, they are just two different implementations of List interface.
LinkedList is implemented with a double-linked list; ArrayList is implemented with a dynamically resizing array.
所以基本的区别于list和array的区别很像,就是for random access, ArrayList is better; for adding and deleting, LinkedList is better.
LinkedList takes more space since it has to store both previous and next pointer. So large lists prefer arrayList.
本文探讨了ArrayList与LinkedList这两种List接口实现方式的区别。ArrayList基于动态调整大小的数组实现,适合随机访问;而LinkedList采用双向链表结构,对于元素的插入和删除操作更为高效,但会占用更多内存。
470

被折叠的 条评论
为什么被折叠?



