arraylist vs linkedlist in java when to use code example
Example 1: what is the difference ArrayList vs LinkedList
ArrayList is array based, internally uses array
LinkedList consists of nodes/values that are related to each other
ArrayList and LinkedList both keep ordering
ArrayList and LinkedList both allow duplicates
Example 2: arraylist vs linkedlist
- ArrayList not syncronized, array based class
- LinkedList not synchronized, doubly linked
ArrayList and LinkedList both keep ordering
ArrayList and LinkedList both allow duplicates