Java offers two types of constructs where you can store multiple objects of the same type: Arrays and Collections. They have following differences and features .
- Array fixed sized and Collections is dynamic sized (Collections automatically expand in size when needed)
- Due to above reason Collections are preferred over Arrays with respect to memory.
- Array can contain both primitive data types as well as objects of a class depending on the definition of the array. However, Collections only supports object entries, not the primitive data types
- With respect to performance its better to use arrays but with respect to performance collection are not good to use.
References Used :- array-vs-arraylist-in-java
Version :- 1.0.0