The most notable difference between the LinkedList and the ArrayList is in the way they store objects.
Array size can be changed in ArrayList during runtime and each element is stored in sequence memory location
LinkedList is a data structure where size cannot be initialized and each node is linked to another node. A node consists of data and address of the next node. These are stored at random memory locations.
The ArrayList is better for storing and accessing data, as it is very similar to a normal array.
The LinkedList is better for manipulating data, such as making numerous inserts and deletes.
crux points:
- If there is a requirement of frequent addition and deletion in an application, then LinkedList is a better choice.
- If there are less add and remove operations and more search operations requirement, ArrayList is a better choice.
Comments
Post a Comment