- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference between Arrays and Collection in Java
In order to store multiple values or objects of the same type, Java provides two types of data structures namely Array and Collection.
The following are the important differences between Arrays and Collection.
Sr. No. | Key | Arrays | Collection |
---|---|---|---|
1 | Size | Arrays are fixed in size i.e once the array with the specific size is declared then we can't alter its size afterward. | The collection is dynamic in size i.e based on requirement size could be get altered even after its declaration. |
2 | Memory Consumption | Arrays due to fast execution consumes more memory and has better performance. | Collections, on the other hand, consume less memory but also have low performance as compared to Arrays. |
3 | Data type | Arrays can hold the only the same type of data in its collection i.e only homogeneous data types elements are allowed in case of arrays. | Collection, on the other hand, can hold both homogeneous and heterogeneous elements. |
4 | Primitives storage | Arrays can hold both object and primitive type data. | On the other hand, collection can hold only object types but not the primitive type of data. |
5 | Performance | Arrays due to its storage and internal implementation better in performance. | Collection on the other hand with respect to performance is not recommended to use. |
- Related Articles
- Difference between collection and collections in java
- Differences between Collection and Collections in Java?
- Difference Between Matrices and Arrays in Python?
- Finding the difference between two arrays - JavaScript
- Find the compatibility difference between two arrays in C++
- Difference between Java and JavaScript.
- Difference between Go and Java.
- Difference Between C++ and Java
- Difference between Groovy and Java
- Difference between constructor and method in Java
- Difference between Object and Class in Java
- Difference between HashMap and HashTable in Java.
- Difference between StringBuilder and StringBuffer in Java
- Difference between string and StringBuffer in Java.
- Difference between == and equals() method in Java.

Advertisements