Java ArrayList of Arrays Last Updated : 08 Oct, 2021 Comments Improve Suggest changes Like Article Like Report ArrayList of arrays can be created just like any other objects using ArrayList constructor. In 2D arrays, it might happen that most of the part in the array is empty. For optimizing the space complexity, Arraylist of arrays can be used. ArrayList<String[ ] > geeks = new ArrayList<String[ ] >(); Example: Input :int array1[] = {1, 2, 3}, int array2[] = {31, 22}, int array3[] = {51, 12, 23} Output: ArrayList of Arrays = {{1, 2, 3},{31, 22},{51, 12, 23}}Approach: Create ArrayList object of String[] type, say, list.Store arrays of string, say, names[], age[] and address[] into list object.Print ArrayList of Array.Below is the implementation of the above approach: Java // Java ArrayList of Arrays import java.io.*; import java.util.*; class GFG { public static void main(String[] args) { // create an ArrayList of String Array type ArrayList<String[]> list = new ArrayList<String[]>(); // create a string array called Names String names[] = { "Rohan", "Ritik", "Prerit" }; // create a string array called Age String age[] = { "23", "20" }; // create a string array called address String address[] = { "Lucknow", "Delhi", "Jaipur" }; // add the above arrays to ArrayList Object list.add(names); list.add(age); list.add(address); // print arrays from ArrayList for (String i[] : list) { System.out.println(Arrays.toString(i)); } } } Output[Rohan, Ritik, Prerit] [23, 20] [Lucknow, Delhi, Jaipur] Comment More infoAdvertise with us Next Article Java ArrayList of Arrays R rohanchopra96 Follow Improve Article Tags : Java Java-ArrayList Practice Tags : Java Similar Reads ArrayList of ArrayList in Java We have discussed that an array of ArrayList is not possible without warning. A better idea is to use ArrayList of ArrayList. Java // Java code to demonstrate the concept of // array of ArrayList import java.util.*; public class Arraylist { public static void main(String[] args) { int n = 3; // Here 1 min read ArrayList in Java Java ArrayList is a part of the collections framework and it is a class of java.util package. It provides us with dynamic-sized arrays in Java. The main advantage of ArrayList is that, unlike normal arrays, we don't need to mention the size when creating ArrayList. It automatically adjusts its capac 9 min read Array vs ArrayList in Java In Java, an Array is a fixed-sized, homogenous data structure that stores elements of the same type whereas, ArrayList is a dynamic-size, part of the Java Collections Framework and is used for storing objects with built-in methods for manipulation. The main difference between array and ArrayList is: 4 min read Custom ArrayList in Java Before proceeding further let us quickly revise the concept of the arrays and ArrayList quickly. So in java, we have seen arrays are linear data structures providing functionality to add elements in a continuous manner in memory address space whereas ArrayList is a class belonging to the Collection 8 min read Iterating over ArrayLists in Java ArrayList is a part of collection framework and is present in java.util package. It provides us with dynamic arrays in Java. Though, it may be slower than standard arrays but can be helpful in programs where lots of manipulation in the array is needed. This class is found in java.util package. With 5 min read Join two ArrayLists in Java Given two ArrayLists in Java, the task is to join these ArrayLists. Examples:Input: ArrayList1: [Geeks, For, ForGeeks] , ArrayList2: [GeeksForGeeks, A computer portal] Output: [Geeks, For, ForGeeks, GeeksForGeeks, A computer portal] Input: ArrayList1: [G, e, e, k, s] , ArrayList2: [F, o, r, G, e, e, 1 min read Internal Working of ArrayList in Java ArrayList is a resizable array implementation in Java. ArrayList grows dynamically and ensures that there is always a space to add elements. The backing data structure of ArrayList is an array of Object classes. ArrayList class in Java has 3 constructors. It has its own version of readObject and wri 10 min read Arrays Class in Java The Arrays class in java.util package is a part of the Java Collection Framework. This class provides static methods to dynamically create and access Java arrays. It consists of only static methods and the methods of an Object class. The methods of this class can be used by the class name itself.The 15 min read Arrays in Java Arrays in Java are one of the most fundamental data structures that allow us to store multiple values of the same type in a single variable. They are useful for storing and managing collections of data. Arrays in Java are objects, which makes them work differently from arrays in C/C++ in terms of me 15+ min read Array to ArrayList Conversion in Java In Java, arrays are fixed-sized, whereas ArrayLists are part of the Java collection Framework and are dynamic in nature. Converting an array to an ArrayList is a very common task and there are several ways to achieve it.Methods to Convert Array to an ArrayList1. Using add() Method to Manually add th 3 min read Like