ArrayList和LinkedList

来源:互联网 发布:libcurl https linux 编辑:程序博客网 时间:2024/06/07 01:37

转载请标明出处: http://blog.csdn.net/wu_wxc/article/details/51424665
本文出自【吴孝城的CSDN博客】

ArrayList:List 接口的大小可变数组的实现
LinkedList:List 接口的链接列表实现

优势:
1.对于随机访问get和set:ArrayList 优于 LinkedList
2.插入:LinkedList 优于 ArrayList
3.删除:LinkedList 优于 ArrayList
4.更新:ArrayList 优于 LinkedList
5.查询:ArrayList 优于 LinkedList

LinkedList在循环时涉及到指针的移动。

如果需要频繁的插入和删除,用LinkedList较好。
如果随机访问比较多的话要用ArrayList

0 0
原创粉丝点击