What is the difference between Array and Collections in Java?


Array

Collections

Performance is good.
Performance is not good compared to array.
Fixed in size.
Size is dynamic (growable).
Stores only homogeneous elements
Store both homogeneous  and heterogeneous elements.
There is no inbuilt Data structure.
Inbuilt Standard Data structure example sorting,searching.
Stores both Primitive and Objects
Stores only Objects not primitive
Memory management not good .because size is fixed there may be waste of memory .
Memory management is good

Comments