Tuesday 23 February 2016

Difference Between Array and Collection

Difference Between Array and Collection

The main difference between Difference Between Array and Collection

Difference between Array and Collection
  • Arrays are fixed in size and hence once we created an array we are not allowed to increase or decrease the size based on our requirement. Collections are growable in nature and hence based on our requirement we can increase or decrease the size.
  • Performance point of view arrays are recommended to use.(Faster)
  • Performance point of view collections are not recommended to use.
  • Arrays can hold only homogeneous elements but Collections can hold both homogeneous and heterogeneous elements.
  • Arrays can hold both primitives as well as objects but Collections can hold only objects.
  • Memory point of view arrays are not recommended to use. Memory point of view collections are recommended to use.

No comments:

Post a Comment