如题 Liststr[ ]这样的数组怎么申请啊?
List<Integer>[] list = new List[100];
这样就行了,不用在意类型
不好意思我是来赚积分儿的,实在不好意思(@-@)!
如果既不想用循环,又想要得到int[],那就只能在jdk8中使用IntStream了。
int[] d = new int[intList.size()];
for(int i = 0;i<intList.size();i++){
d[i] = intList.get(i);
}
System.out.println(Arrays.toString(d));
List[] 即可
不用给确定数字呀,让他自己扩充就行了
static List list = new List();
static List list = new List();
写一个二维数组int[][] is=new int[10][];
最直接的数组里面套数组的方式就是二维数组了
public class Array {
public static void main(String [] args) {
List list = new ArrayList();
Integer [] a = {1,2};
Integer [] b = {8,9,0};
Integer [] c = {1,4};
list.add(a);
list.add(b);
list.add(c);
for(Integer[] i:list){
System.out.println(Arrays.toString(i));
}
}
}
是这个意思么 你可以试一试 把list的泛型改一下就可以了
List [] str;
List[] list = new List[10];