Wednesday, July 22, 2015

What are the differences between Arrays and Collections

  • Arrays are fixed in size, therefore once we create an array we are not allowed to increase or decrease its size, based on the requirement. Collections are grow-able, therefore base on our requirement we can increase or decrease its size
  • Arrays use more memory space as compared to Collections
  • Performance point of view arrays are recommended (Faster), where as collections are not recommended
  • Arrays can hold only homogeneous elements, collections can hold both homogeneous and heterogeneous elements
  • Arrays can hold both primitives as well as objects, where as collection can not hold primitives (although they can store primitive wrapper classes such as Integer etc)
  • In Array , there are no underlined Data Structures, whereas ,Collection has Underlined DS

No comments:

Post a Comment