

{"id":15199,"date":"2018-05-19T06:24:28","date_gmt":"2018-05-19T06:24:28","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=15199"},"modified":"2026-05-30T15:50:45","modified_gmt":"2026-05-30T10:20:45","slug":"array-vs-arraylist-java","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/","title":{"rendered":"Array vs ArrayList in Java Learn with Examples"},"content":{"rendered":"<p>One of the main objectives of a programmer is to handle data efficiently. There are numerous data structures that help programmers perform data handling. Array is one of the most used data structures to store data, it has been around for a very long time. The reason why array is used so often is due to its simple implementation. This helps newcomers understand data structure at an ease. There is another provision in the java collection framework, known as ArrayList. In this article, we will take a look at all the similarities and dissimilarities of Array vs ArrayList in java.<\/p>\n<h3>What is an Array in Java?<\/h3>\n<p>An array is a simple data structure with a contiguous memory location, in which data are stored with the same name but different index numbers. The data stored in an array must be of the same type. The size of an array is fixed after declaration.<\/p>\n<p><strong>Syntax of Array in Java:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">datatype array_name = new dataype[Size_of_Array];\r\n<\/pre>\n<p><strong>Example Array in Java:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">int Arr = new int[100];\r\n<\/pre>\n<h3>What is an ArrayList in Java?<\/h3>\n<p>Unlike Array, ArrayList is a dynamic data structure that is part of the java collection framework. It also contains elements of the same type. Here we do not need to specify the size of the list.<\/p>\n<p>ArrayList in Java has the power to increase or decrease the size of an array, allowing the updating and deletion of data after the array is created.<\/p>\n<p><strong>Syntax of ArrayList in Java:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">ArrayList &lt;Wrapper Class&gt; object_name=new ArrayList&lt;Wrapper Class&gt;();\r\n<\/pre>\n<p><strong>Example of ArrayList in Java:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">ArrayList &lt;Integer&gt; Arr=new ArrayList&lt;Integer&gt;();\r\n<\/pre>\n<h3>Similarities Between Java Array and ArrayList<\/h3>\n<ul>\n<li>Array and ArrayList are both Data structures used to store data of the same type.<\/li>\n<li>Null values can be stored in both Array and ArrayList.<\/li>\n<li>Duplicate values can be incorporated into them, but the data type has to be the same.<\/li>\n<li>The order of the elements is not preserved.<\/li>\n<li>Both the array and the array list arrange the item by using indexing.<\/li>\n<li>For iterating the element of an array and array list, loops can be used.<\/li>\n<\/ul>\n<p>Now that we have seen the similarities between them, in reality, they are quite different.<\/p>\n<p>Let us discuss the differences between them in detail.<\/p>\n<h3>Difference Between Java Array vs ArrayList<\/h3>\n<p><strong>1. Nature:<\/strong> Arrays are static data structures in nature. This means, once declared, the size of the array cannot be altered whatsoever. Meanwhile, ArrayList is a dynamic data structure. We do not need to specify any length of ArrayList while declaring it. The size of ArrayList grows in size when and where needed.<\/p>\n<p><strong>2. Implementation:<\/strong> Array is by default incorporated into the JVM. It is a fundamental feature of the Java Programming Language. Meanwhile, ArrayList is present in the Java Collection Framework API. ArrayList is a class that uses Array implicitly to perform various tasks. We can create objects of the ArrayList class and call methods with it. An array on the other hand is a composite data type of java. We cannot call methods with an array except length.<\/p>\n<p><strong>3. Performance:<\/strong> Since ArrayList implicitly uses Array, we might think they perform at the same speed. It is partially correct. ArrayList performs all the basic functionalities with the same speed as an Array. But ArrayList performs various extra functions that perform slowly as it affects the CPU memory. For example, if we resize the ArrayList, it would copy the content of the array to another array then resize it. This slows down the performance of ArrayList.<\/p>\n<p><strong>4. Flexibility:<\/strong> It is one of the main differences between an Array and an ArrayList. ArrayList is far more flexible when compared to an array. An array is a static data structure and is very hard to resize. Meanwhile, ArrayList is very flexible and changes the size very easily and automatically. This makes ArrayList a lot more flexible when compared to arrays. Moreover, we can easily add or remove elements from an ArrayList, whereas arrays do not provide such facilities. It is very hard to remove elements from an array once added.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Integer intObject[] = new Integer[100];\r\nintObject[0] = new Integer(21); \/\/new Wrapper class object is added to the array object\r\n<\/pre>\n<p><strong>5. Type<\/strong> <strong>of data stored:<\/strong> Arrays can contain any element from primitive data to object of a class. Whereas ArrayList contains only objects, it cannot have primitive data in it. However, there is a workaround to it, we can use autoboxing to store primitive data values. Let us see how using an <strong>example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">ArrayList Arr = new ArrayList();\r\nArr.add(21); \/\/  add 21 int primitive data type\r\n<\/pre>\n<p>This is possible because ArrayList uses wrapper class objects to store data.<\/p>\n<p><strong>6. Generics:<\/strong> Generics is a feature in java that was added in the year 2004. A major difference between array and ArrayList is that ArrayList supports generics while array does not support generics. The reason being that array is of covariant type while generics are invariant. This is why the compiler doesn\u2019t allow arrays to store generics. ArrayLists do not have such problems.<\/p>\n<p><strong>7. Iteration:<\/strong> Iteration is very important when it comes to data handling, as we have to traverse through the data to find the desired result. The array supports only for loop, for-each loop, while loop, do-while loop. ArrayList on the other hand supports the facility of iterators. We can use ListIterator to iterate through the ArrayList. ArrayList also supports loops, while arrays can never support iterators.<\/p>\n<p><strong>8. Checking the Size:<\/strong> Both arrays and ArrayList have library functions to check their size. Arrays use the length object to check the length. Ar\u0325rayList uses the size() method to check the size. There is a difference here as well, the length object basically returns the total length of the array, it cannot calculate the amount of filled and empty spaces in the array. The size() method on the other hand returns the current capacity of the ArrayList.<\/p>\n<p><strong>Example:<\/strong><br \/>\n1.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">int Arr[] = new int[100];\r\narrayLength = array.length; \/\/using the length object\r\n<\/pre>\n<p>2.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">ArrayList ArrL = new ArrayList();\r\nArrL.add(21);\r\nArrL.size(); \/\/using the size() method\r\n<\/pre>\n<p><strong>9. Dimension:<\/strong> This is a very big difference between Arrays and ArrayList. In Array, we can create multidimensional arrays according to our needs. This helps us represent data of graphs, trees and other real-life objects at an ease. But, ArrayList does not have any such feature, Arraylists are a single dimension by default and it cannot be made multidimensional whatsoever. This is a very big drawback in ArrayList when it comes to data representation.<\/p>\n<p><strong>Example of dimension in java:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Integer myArray[][] = new Integer[10][10]; \/\/multidimensional array of size 10x10\r\nmyArray[0][0] = new Integer(21);\r\n<\/pre>\n<p><strong>10. Type Safety:<\/strong> ArrayLists supports generics, thus ArrayList is Type-Safe, i.e, ArrayList allows the compiler to check the object for correctness. Array doesn\u2019t have any such provision, thus arrays are not type-safe. ArrayList supports compile-time checking whereas arrays support Runtime checking. Thus in an array, if the data is incorrect, it will give an ArrayStoreException at runtime.<\/p>\n<p><strong>Example of type safety in java:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">String stringArray[] = new String[100];\r\n\/\/ creates a string array of size 100\r\nstringArray[0] = new Integer(21);\r\n\/\/ throws ArrayStoreException, trying to add Integer object in String[], thus ensuring type safety.\r\n<\/pre>\n<p><strong>11. Supported Operations:<\/strong> To make the tasks of the programmer easier, ArrayList contains various methods that perform various important functions. Array lists support methods like get(), isEmpty(), indexOf(), replaceAll(), contains(), clear(), removeAll(), which makes programs a lot easier. Arrays on the other hand do not have these methods and everything has to be done manually, making array operations hard to perform.<\/p>\n<h3>Array vs Arraylist in Java<\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>Property<\/b><\/td>\n<td><b>Array<\/b><\/td>\n<td><b>ArrayList<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Definition<\/span><\/td>\n<td><span style=\"font-weight: 400\">An array is a simple data structure with a contiguous memory location, in which data are stored with the same name but different index numbers. The data stored in an array must be of the same type. The size of an array is fixed after declaration.<\/span><\/td>\n<td><span style=\"font-weight: 400\">ArrayList is a dynamic data structure that is part of the java collection framework. It also contains elements of the same type. Here we do not need to specify the size of the list.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Static\/Dynamic<\/span><\/td>\n<td><span style=\"font-weight: 400\">Arrays are static<\/span><\/td>\n<td><span style=\"font-weight: 400\">ArrayList is Dynamic<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Resizable<\/span><\/td>\n<td><span style=\"font-weight: 400\">Fixed Length<\/span><\/td>\n<td><span style=\"font-weight: 400\">Resize Possible<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Initialization\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400\">It is mandatory to mention the size of an array during initialization<\/span><\/td>\n<td><span style=\"font-weight: 400\">We do not need to mention the size in the case of ArrayList<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Performance<\/span><\/td>\n<td><span style=\"font-weight: 400\">Faster<\/span><\/td>\n<td><span style=\"font-weight: 400\">Slower<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Primitive\/Generic Type<\/span><\/td>\n<td><span style=\"font-weight: 400\">An array can store objects and primitive data, but not generics.<\/span><\/td>\n<td><span style=\"font-weight: 400\">ArrayList can store Objects and generics but cannot store primitive type data.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Iteration<\/span><\/td>\n<td><span style=\"font-weight: 400\">Only Loops are allowed<\/span><\/td>\n<td><span style=\"font-weight: 400\">Loops and iterators are allowed<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Type-Safety<\/span><\/td>\n<td><span style=\"font-weight: 400\">Not type-safe<\/span><\/td>\n<td><span style=\"font-weight: 400\">It is type-safe<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Length<\/span><\/td>\n<td><span style=\"font-weight: 400\">Uses length object<\/span><\/td>\n<td><span style=\"font-weight: 400\">Uses size() function<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Adding Elements<\/span><\/td>\n<td><span style=\"font-weight: 400\">It uses assignment operator for adding<\/span><\/td>\n<td><span style=\"font-weight: 400\">It uses add() method<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Single\/Multi-Dimensional<\/span><\/td>\n<td><span style=\"font-weight: 400\">Both single and multidimensional possible<\/span><\/td>\n<td><span style=\"font-weight: 400\">Only single dimensional allowed<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Example of Array and ArrayList using Java Programming<\/h3>\n<p>Now we will discuss a few programs to understand the differences properly.<\/p>\n<h4>Code to Understand Array vs ArrayList Differences(Initialization and Access):<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import java.util.Arrays;\r\npublic class arrVSarrL_Diff\r\n{\r\n   public static void main(String args[]) {\r\n    \/\/Creating and Initializing a Normal Array\r\n    int[] arrN = new int[5];\r\n    arrN[0] = 1;\r\n    arrN[1] = 2;\r\n    arrN[2] = 3;\r\n    arrN[3] = 4;\r\n    arrN[4] = 5;\r\n    \/\/Accessing Array elements\r\n    System.out.println(\"The first element of Array is: \" + arrN[0]);\r\n    System.out.println(\"The second element of Array is: \" + arrN[1]);        \r\n    \/\/Creating an ArrayList with capacity 5 \r\n    ArrayList &lt; Integer &gt; arrL = new ArrayList &lt; Integer &gt; (5);\r\n    \/\/ Add elements to ArrayList \r\n    arrL.add(1);\r\n    arrL.add(2);\r\n    arrL.add(3);\r\n    arrL.add(4);\r\n    arrL.add(5);\r\n    \/\/ Accessing the  elements of ArrayList \r\n    System.out.println(\"The first element of ArrayList is: \" + arrL.get(0));\r\n    System.out.println(\"The second  element of ArrayList is: \" + arrL.get(1));\r\n  }\r\n}\r\n<\/pre>\n<p><strong>The output of the above code:<\/strong><\/p>\n<div class=\"code-output\">The first element of Array is: 1<br \/>\nThe second element of Array is: 2<br \/>\nThe first element of ArrayList is: 1<br \/>\nThe second element of ArrayList is: 2<\/div>\n<h4>Code to illustrate that arrays need to have a fixed declared size while ArrayList Doesn\u2019t:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.DataFlair.ArrayVsArrayList;\r\nimport java.util.ArrayList;\r\nimport java.util.Arrays;\r\npublic class Fixed_NotFixed\r\n{\r\n     public static void main(String args[]) {\r\n    \/\/Normal arrays in which we need to specify the size for array(here 5) \r\n    int[] Arr = new int[5];\r\n    Arr[0] = 1;\r\n    Arr[1] = 2;\r\n    Arr[2] = 3;\r\n    Arr[3] = 4;\r\n    Arr[4] = 5;\r\n    System.out.println(\"Accessing array contents:\");\r\n    System.out.println(Arrays.toString(Arr));\r\n    \/* We cannot add more elements to array Arr as it is fixed size, otherwise we will get an error(ArrayIndexOutOfBound).*\/\r\n    \/\/ArrayList we need not to specify size in ArrayList\r\n    ArrayList &lt; Integer &gt; ArrL = new ArrayList &lt; Integer &gt; ();\r\n    ArrL.add(1);\r\n    ArrL.add(2);\r\n    ArrL.add(3);\r\n    ArrL.add(4);\r\n    \/\/ We can add more elements to ArrL, as many as we want.\r\n    System.out.println(\"Accessing ArrayList contents:\");\r\n    System.out.println(ArrL);\r\n  }\r\n}\r\n<\/pre>\n<p><strong>The output of the above code:<\/strong><\/p>\n<div class=\"code-output\">Accessing array contents:<br \/>\n[1, 2, 3, 4, 5]<br \/>\nAccessing ArrayList contents:<br \/>\n[1, 2, 3, 4]<\/div>\n<h4>Code to explain that primitive data types are not allowed in ArrayList, Wrapper Class is allowed:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.DataFlair.ArrayVsArrayList;\r\nimport java.util.ArrayList;\r\npublic class primitive_nonprimitive\r\n{\r\n    public static void main(String args[]) {\r\n    \/\/ primitive types allowed in an array\r\n    int[] array = new int[3];\r\n    \/\/ Objects are also allowed in an array\r\n    primitive_nonprimitive[] array1 = new primitive_nonprimitive[3];\r\n    \/\/ Not allowed to add primitive type-below line gives compiler error\r\n    ArrayList &lt; char &gt; arrayList = new ArrayList &lt; char &gt; ();\r\n    \/\/ This is Allowed in ArrayList as Wrapper Class is Used\r\n    ArrayList &lt; Integer &gt; arrayList1 = new ArrayList &lt; &gt;();\r\n    ArrayList &lt; String &gt; arrayList2 = new ArrayList &lt; &gt;();\r\n    ArrayList &lt; Object &gt; arrayList3 = new ArrayList &lt; &gt;();\r\n  }\r\n}\r\n<\/pre>\n<p><strong>The output of the above code:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/arraylist-error-when-primitive-data-used.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-108975\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/arraylist-error-when-primitive-data-used.webp\" alt=\"arraylist error when primitive data used\" width=\"1920\" height=\"1032\" \/><\/a><\/p>\n<div class=\"code-output\">The compiler doesn\u2019t let us compile the program because ArrayList checks incompatibility at compile time.<br \/>\nArrayList&lt;char&gt; arrayList = new ArrayList&lt;char&gt;();<br \/>\n^<br \/>\nrequired: reference<br \/>\nfound: char<\/div>\n<h3>Conclusion<\/h3>\n<p>As we saw in this article, both array and ArrayList have advantages and disadvantages of their own. In some cases using an array is beneficial while in others ArrayList has an upper hand. It is up to us to judge what to use at what time. In this article, we saw the similarities and dissimilarities between them and we also saw their implementation through java programs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the main objectives of a programmer is to handle data efficiently. There are numerous data structures that help programmers perform data handling. Array is one of the most used data structures to&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":108974,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[1124,1125,1126,2763,3820,10157],"class_list":["post-15199","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-array-vs-arraylist-example","tag-array-vs-arraylist-java","tag-array-vs-arraylist-performance","tag-comparison-of-array-vs-arraylist-in-java","tag-difference-between-array-and-arraylist","tag-processing-array-vs-arraylist"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Array vs ArrayList in Java Learn with Examples - DataFlair<\/title>\n<meta name=\"description\" content=\"Array vs ArrayList in Java: introduction to Java Array and Arraylist Java, Difference between Array and ArrayList with examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Array vs ArrayList in Java Learn with Examples - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Array vs ArrayList in Java: introduction to Java Array and Arraylist Java, Difference between Array and ArrayList with examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-05-19T06:24:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-30T10:20:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/java-array-vs-arraylist.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Array vs ArrayList in Java Learn with Examples - DataFlair","description":"Array vs ArrayList in Java: introduction to Java Array and Arraylist Java, Difference between Array and ArrayList with examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/","og_locale":"en_US","og_type":"article","og_title":"Array vs ArrayList in Java Learn with Examples - DataFlair","og_description":"Array vs ArrayList in Java: introduction to Java Array and Arraylist Java, Difference between Array and ArrayList with examples.","og_url":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-05-19T06:24:28+00:00","article_modified_time":"2026-05-30T10:20:45+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/java-array-vs-arraylist.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Array vs ArrayList in Java Learn with Examples","datePublished":"2018-05-19T06:24:28+00:00","dateModified":"2026-05-30T10:20:45+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/"},"wordCount":1537,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/java-array-vs-arraylist.webp","keywords":["Array vs Arraylist example","Array Vs ArrayList Java","array vs arraylist performance","comparison of Array vs ArrayList in Java","difference between Array and ArrayList","processing Array vs Arraylist"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/","url":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/","name":"Array vs ArrayList in Java Learn with Examples - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/java-array-vs-arraylist.webp","datePublished":"2018-05-19T06:24:28+00:00","dateModified":"2026-05-30T10:20:45+00:00","description":"Array vs ArrayList in Java: introduction to Java Array and Arraylist Java, Difference between Array and ArrayList with examples.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/java-array-vs-arraylist.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/05\/java-array-vs-arraylist.webp","width":1200,"height":628,"caption":"java array vs arraylist"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/array-vs-arraylist-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Java Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/java\/"},{"@type":"ListItem","position":3,"name":"Array vs ArrayList in Java Learn with Examples"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/15199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=15199"}],"version-history":[{"count":7,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/15199\/revisions"}],"predecessor-version":[{"id":148524,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/15199\/revisions\/148524"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/108974"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=15199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=15199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=15199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}