W3docs

ArrayList of int array in java

To create an ArrayList of int arrays in Java, you can use the following syntax:

To create an ArrayList of int arrays in Java, you can use the following syntax:


List<int[]> list = new ArrayList<>();

This creates an ArrayList that can hold arrays of int values. You can add an int array to the list using the add method:


int[] array = {1, 2, 3};
list.add(array);

You can retrieve an array from the list using the get method:


int[] retrieved = list.get(0);  // retrieved is {1, 2, 3}

I hope this helps! Let me know if you have any questions.