Java Array vs ArrayList
Summary: This tutorial "Java Array vs ArrayList", tables you the differences between array and arraylist at a glance to remember easily.
Both array and ArrayList are well familiar and used by the programmer very often. Both are interoperable – array to arraylist and arraylist to array.
Following table gives the differences of Java Array vs ArrayList
Array | ArrayList |
---|---|
Stores primitive data types and also objects | Stores only objects |
Defined in Java language itself as a fundamental data structure | Belongs to collections framework |
Fixed size | Growable and resizable. Elements can be added or removed |
Stores similar data of one type | Can store heterogeneous data types |
It is not a class | It is a class with many methods |
Cannot be synchronized | Can be obtained a synchronized version |
Elements retrieved with for loop | Can be retrieved with for loop and iterators |
Elements accessible with index number | Accessing methods like get() etc. are available |
Can be multidimensional | — |
Array related topics that increase array manipulation techniques
For extra reading of differences between various Java entities:
2. int to Binary, Octal, Hexa
3. Converting Numbers to Words
Pass your comments and suggestions to improve the quality of this Web site in this tutorial "Java Array vs ArrayList".
multidimensional?
An ArrayList is easily as multidimensional as a Array. A multidimensional array is an Array of Arrays. A multidimensional List is just a List of List.
A list can have elements of lists. That is, element is a list.
Is Array not a class in java?
Array is a class containing methods to operate on array elements.