A programmer has an algorithm that requires a java.util.List that provides an
efficient implementation of add(0, object), but does NOT need to support quick
random access.
What supports these requirements?
A. java.util.Queue
B. java.util.ArrayList
C. java.util.LinearList
D. java.util.LinkedList
Answer: ( D )
参考大纲:集合
请高手讲解,选B行吗,而且题目也看不太清楚
efficient implementation of add(0, object), but does NOT need to support quick
random access.
What supports these requirements?
A. java.util.Queue
B. java.util.ArrayList
C. java.util.LinearList
D. java.util.LinkedList
Answer: ( D )
参考大纲:集合
请高手讲解,选B行吗,而且题目也看不太清楚
对于随机访问get和set,ArrayList觉得优于LinkedList,因为LinkedList要移动指针。
对于新增和删除操作add和remove,LinedList比较占优势,因为ArrayList要移动数据。有以上可以知道,D才满足题目的需求。