【发布时间】:2011-06-01 14:56:47
【问题描述】:
所以,我想要一个 Java 中的整数向量数组。
如果我放
Vector<Integer>[] matrix;
matrix = new Vector<Integer>[100];
我得到不能编译错误
无法创建 Vector 的通用数组
我应该使用
matrix = new Vector[100];
相反? (发出警告)
或者我应该干脆不使用向量数组,而是使用向量的向量吗?
注意:我不想要 Vector
【问题讨论】:
-
只有我一个人努力追随这种思路吗?
-
你真的应该使用
List而不是Vector。您不使用数组数组或 v̶e̶c̶t̶o̶r̶̶o̶f̶̶v̶e̶c̶t̶o̶r̶s̶ 列表列表是否有特殊原因? -
List是一个接口,你可能是指ArrayList。