ArrayList可以方便的实现列表操作,但有时候需要建立一个ArrayList数组. 首先想到的是类似下面的方法: ArrayList<Integer[]list=newArrayList<Integer()[N]; 但会出现错误. 改为 ArrayList[]list=newArrayList[N];会有警告. 这是因为Java没有范型数组,可以参考以下方法实现类似功能: ArrayList<ArrayList<Integerals=newArrayList<ArrayList<Integer(); ArrayList<Integera1=newArrayList<Integer(); ArrayList<Integera2=newArrayList<Integer(); ArrayList<Integera3=newArrayList<Integer();
顶一下

(0)
0%
踩一下

(0)
0%
- 相关评论
- 我要评论
-