Selenium Lists and Array Lists

What are the difference between lists and array lists?

Questions by akhilandeswari   answers by akhilandeswari

Showing Answers 1 - 6 of 6 Answers

praveen

  • Mar 1st, 2016
 

1) ArrayList internally uses dynamic array to store the elements.
LinkedList internally uses doubly linked list to store the elements.

2) Manipulation with ArrayList is slow because it internally uses array. If any element is removed from the array, all the bits are shifted in memory. Manipulation with LinkedList is faster than ArrayList because it uses doubly linked list so no bit shifting is required in memory.

3) ArrayList class can act as a list only because it implements List only. LinkedList class can act as a list and queue both because it implements List and Deque interfaces.

4) ArrayList is better for storing and accessing data.
LinkedList is better for manipulating data.

  Was this answer useful?  Yes

Mohit

  • Jan 15th, 2018
 

List - List is an interface which extends Collection. We can add duplicates in List. It stores elements on the basis of index and it also maintain insertion order. It allows null.

ArrayList - ArrayList is an implementing class of List. It internally use dynamic array or auto growable array to store the elements. I maintain insertion order. Allows null and duplicates. It is best suitable for retrieval purpose.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions