Java – Is ArrayList[][] possible? Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Java – Is ArrayList[][] possible? without wasting too much if your time.

The question is published on by Tutorial Guruji team.

ArrayList<Integer>[][] matrix = new ArrayList<Integer]>[sizeX][sizeY]();

or

ArrayList<Integer>[][] matrix = new ArrayList<Integer]>()[sizeX][sizeY];

don’t work, I’m starting to think that it’s not even possible to store ArrayLists in a matrix?

Answer

If you still want to use and array:

    ArrayList<Integer>[][] matrix = new ArrayList[1][1];
    matrix[0][0]=new ArrayList<Integer>();
    //matrix[0][0].add(1);
We are here to answer your question about Java – Is ArrayList[][] possible? - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji