What is difference between Array and ArrayList ? When will you use Array over ArrayList ?
Arrayscan contain primitive or objects, while an
ArrayListcan contain only objects.
Arrayshave fixed size, while an
ArrayListprovides more methods and features, such as
- For a list of primitive data types, the collections use autoboxing to reduce the coding effort. However, this approach makes them slower when working on fixed size primitive data types.