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

后端 未结 4 682
长发绾君心
长发绾君心 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 16:51

    1. Arrays are fixed in length where as collections are growable in nature.
    2. Arrays can store homogeneous elements whereas collections can store both.
    3. If you know the size in advance, go for Arrays
    4. Performance point of view, better to go with Arrays
    5. Arrays does not have any ready made methods whereas Collections have ready made methods.

提交回复
热议问题