Below are some of the differences between Arrays and Collection:
|Arrays are fixed in size that is once we create an array we can not increased or decreased based on our requirement.||Collection are growable in nature that is based on our requirement. We can increase or decrease of size.|
|With respect to memory Arrays are not recommended to use.||With respect to memory collection are recommended to use.|
|With respect to performance Arrays are recommended to use.||With respect to performance collection are not recommended to use.|
|Arrays can hold only homogeneous data types elements.||Collection can hold both homogeneous and and heterogeneous elements.|
|There is no underlying data structure for arrays and hence ready made method support is not available.||Every collection class is implemented based on some standard data structure and hence for every requirement ready made method support is available being a performance. we can use these method directly and We are not responsible to implement these methods.|
|Arrays can hold both object and primitive.||Collection can hold only object types but primitive.|
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- Java Collection| Difference between Synchronized ArrayList and CopyOnWriteArrayList
- Finding minimum and maximum element of a Collection in Java
- Sorting collection of String and StringBuffer in Java
- Garbage Collection in Java
- Retrieving Elements from Collection in Java (For-each, Iterator, ListIterator & EnumerationIterator)
- Output of Java programs | Set 10 (Garbage Collection)
- How to make object eligible for garbage collection in Java?
- How to prevent objects of a class from Garbage Collection in Java
- Iterator vs Collection in Java
- Convert an Iterable to Collection in Java
- Non-generic Vs Generic Collection in Java
- Collection addAll() method in Java with Examples
- Collection add() method in Java with Examples
- Collection clear() method in Java with Examples
- Collection isEmpty() method in Java with Examples
- Collection contains() method in Java with Examples
- Stack addAll(int, Collection) method in Java with Example
- Stack addAll(Collection) method in Java with Example
- How to add all items from a collection to an ArrayList in Java?
- How to add selected items from a collection to an ArrayList in Java?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : mohddanishsajid