Differences between an array and any collection from the java Collection framework?

后端 未结 4 678
长发绾君心
长发绾君心 2021-02-02 16:29

As the title say I am looking into the \"Differences between an array and any collection from the java Collection framework\".

Thought it\'s high level enough to provide

4条回答
  •  北海茫月
    2021-02-02 17:10

    6 difference between Arrays and Collections are following:

    1. Arrays are fixed in size but Collections are dynamic in size.
    2. With respect to memory arrays are not good to use but with respect to memory Collections are better to use.
    3. With respect to performance its better to use arrays but with respect to performance collection are not good to use.
    4. Arrays can hold only homogeneous elements but collections can hold both homogeneous and heterogeneous elements
    5. Arrays don't have ready made methods but collections have ready made data structures and methods.
    6. Arrays can hold both primitives and wrapper objects but collections can hold only objects.

提交回复
热议问题