蔡香满屋
站在牛顿头上吃苹果

ArrayList和LinkedList的主要有两点区别如下:
1.ArrayList是实现了基于动态数组的数据结构,LinkedList基于链表的数据结构(LinkedList是双向链表,有next也有previous)。 
2.对于随机访问get和set,ArrayList觉得优于LinkedList,因为LinkedList要移动指针。 
3.对于新增和删除操作add和remove,LinedList比较占优势,因为ArrayList要移动数据。

所以以后要注意:

即在search()查询方法中使用:List<String> idList = new ArrayList<>();

在insert()新增或者删除delete()方法中使用:List<String> idList = new LinkedList<>();

posted on 2018-09-03 12:05  蔡香满屋  阅读(116)  评论(0)    收藏  举报