difference between list and arraylist code example

Example 1: Difference between Array vs ArrayList

Arrays are fixed size
ArrayList's size auotomatically adjusted
Arrays can hold primitives and object
ArrayList can hold only objects
Arrays can be multi dimensional
ArrayList cannot be multi-dimentional
Array is a build in data structure
ArrayList is implementing class of List interface in Collection framework

Example 2: 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

Tags:

Java Example