Difference Between Array and Collection Framework
Advertisements
Difference Between Array and Collection Framework
The main advantage of Collection Framework are Collections are grow-able in nature, hence based on our requirement we can increase or decrease the size. Some others advantage are given below;
- Collection is re-sizable or dynamically draw-able memory.
- Provides useful data structures in the form of predefined classes that reduces programming affords.
- It support to store heterogeneous elements or object.
- It provides higher performance.
- It provides Extendability (depends on incoming flow of data,if the size of collection framework variable is increasing than the collection framework variable is containing Extendability feature).
- It provides adaptability facility( The process of adding the content of one collection framework variable to another collection framework either in the beginning or in the ending or in the middle in known as adaptability).
- It is one of the algorithmic oriented.
- It provides in-built sorting technique.
- It provides in-built searching technique.
- It provides higher preliminary concepts of Data Structure such as:- Stack,Queue,LinkedList,Trees ..etc.
Difference between Array and Collection Framework
Array | Collection | |
---|---|---|
1 | 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 grow-able in nature and hence based on our requirement we can increase or decrease the size. |
2 | Arrays can hold both primitives as well as objects. | Collections can hold only objects but not primitive. |
3 | Performance point of view arrays faster than collection | Performance point of view collections are slower than array |
4 | Arrays can hold only homogeneous elements. | Collections can hold both homogeneous and heterogeneous elements. |
5 | Memory point of view arrays are not recommended to use. | Memory point of view collections are recommended to use. |
6 | For any requirement, there is no ready method available. | For every requirement ready made method support is available. |
Note: Above difference is same for difference between Array and any Collection object (like Vector, ArrayList, LinkedList).
Google Advertisment