List of Arrays in Java

In Java, you can create a List of arrays using the syntax shown below:

java

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

Here, List is the interface and ArrayList is the implementation. The angle brackets <> specify the type of elements the list will contain, in this case, arrays of integers int[].

You can add elements to the list using the add method, like this:

csharp

list.add(new int[] {1, 2, 3});
list.add(new int[] {4, 5, 6});