Difference between Arrays and Collection in Java Last Updated : 29 Mar, 2023 Comments Improve Suggest changes Like Article Like Report An array in Java is a group of like-typed variables referred to by a common name. Arrays in Java work differently than they do in C/C++. Following are some important points about Java arrays. On the other hand, any group of individual objects which are represented as a single unit is known as the collection of the objects. In Java, a separate framework named the “Collection Framework” has been defined in JDK 1.2 which holds all the collection classes and interface in it. The most essential thing while dealing Collection is to have super strong grasp of Collection framework which in one go is depicted via below image as follows: Example Java // Java Program to Illustrate Difference // Between Arrays and Collection // Importing required classes import java.util.*; // Main class class GFG { // Main driver method public static void main(String[] args) { // Arrays String[] gfg = new String[] { "G", "E", "E", "K", "S" }; // Trying printing the above array System.out.print(gfg); // New Line System.out.println(); // Collection // Let us arbitarly create an empty ArrayList // of string type ArrayList<String> al = new ArrayList<String>(); // Adding elements to above List // using add() method al.add("g"); al.add("e"); al.add("e"); al.add("k"); al.add("s"); // Printing all elements of Collection (ArrayList) System.out.println(al); } } Output[Ljava.lang.String;@3d075dc0 [g, e, e, k, s] Now after having understanding of Arrays and Collection, let us now tabulate differences between them which is as follows: ArraysCollection1Arrays 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.2Write in memory Arrays are not recommended to use.Write in memory collection are recommended to use.3With respect to performance Arrays are recommended to use.With respect to performance collection are not recommended to use.4Arrays can hold only homogeneous data types elements.Collection can hold both homogeneous and heterogeneous elements.5There 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, ready-made method support is available for every requirement. As performance is crucial, we can use these methods directly, and we are not responsible for implementing them.6Arrays can hold both object and primitive data type .Collection can hold only object types but not primitive datatypes such as int, long, short, etc. Comment More infoAdvertise with us Next Article Difference between Arrays and Collection in Java K keep_silent Follow Improve Article Tags : Java Practice Tags : Java Similar Reads Difference Between Streams and Collections in Java Collection is an in-memory data structure, which holds all the values that the data structure currently has. Every element in the Collection has to be computed before we add it to the Collection. Operations such as searching, sorting, insertion, manipulation, and deletion can be performed on a Colle 3 min read Difference between List and ArrayList in Java A Collection is a group of individual objects represented as a single unit. Java provides a Collection Framework which defines several classes and interfaces to represent a group of objects as a single unit This framework consists of the List Interface as well as the ArrayList class. In this article 4 min read Difference between Array and String in Java An array is a collection of similar type of elements that are stored in a contiguous memory location. Arrays can contain primitives(int, char, etc) as well as object(non-primitives) references of a class depending upon the definition of the array. In the case of primitive data type, the actual value 5 min read Difference between ArrayList and HashSet in Java Here are couple of differences between ArrayList and HashSet. Inheritance: Implementation: Implementation : ArrayList implements List interface while HashSet implements Set interface in Java.Internal implementation: ArrayList is backed by an Array while HashSet is backed by an HashMap.Duplicates : A 3 min read Difference Between List and Set in Java The List interface allows storing the ordered collection. It is a child interface of Collection. It is an ordered collection of objects in which duplicate values are allowed to store. List preserves the insertion order, it allows positional access and insertion of elements. Declaration: public abstr 2 min read Like