且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何用Java创建2D ArrayList的?

更新时间:2023-07-21 08:45:22

我想创建一个二维数组,每个单元是一个ArrayList!

如果你想创建 ArrayList的一个2D的阵列 。然后你可以这样做:

If you want to create a 2D array of ArrayList.Then you can do this :

ArrayList[][] table = new ArrayList[10][10];
table[0][0] = new ArrayList(); // add another ArrayList object to [0,0]
table[0][0].add(); // add object to that ArrayList

推荐文章