In Java, Arrays and Collections both are to deal with a group of objects but there are lots of differences in terms of data structure or performing operations.
Here are some most common differences:
Difference between Arrays & Collections
Arrays | Collections |
Arrays is having fixed-length.. | Collections are growable in nature i.e increase or decrease. |
Arrays are not recommended in terms of memory concerns. | Collections use different data structures and recommended to use with respect to memory. |
Arrays are used with respect to performance. | Collections are not recommended to use with respect to performance. |
Arrays can store only homogeneous (same type) of data. | Collections can hold both homogeneous and heterogeneous elements. |
Arrays do not have a single API. | Collections having big list of methods. |
Arrays can work with primitives and object types. | Collections can hold only objects but not with primitive. If you pass as primitive internally convert to object. |
See Also: Array & Arrays Class Examples | See Also: Collection Framework and Examples |