嘿伙计们,我正在尝试数组列表,我需要创建一个可变大小的整数数组。我不知道我是否正确实施它。我该怎么做呢?有人可以帮我解决语法吗?
Integer[] ints = new Integer[x];
static List<Integer> ints = new ArrayList<Integer>();
我希望能够做类似 ints.add(0); 之类的事情。等等
编辑:代码:
Integer[] ints = new Integer[x];
static List<Integer> ints = new ArrayList<Integer>();
ints.clear();
for (int counter2 = 0; counter2 < 50; counter2++) {
if (list[counter2].userActive == true) {
if (list[counter2].getLastName().equals(lastName) || (lastName=="")) {
if ((list[counter2].getFirstName().equals(firstName))||(firstName=="")
&& (list[counter2].userActive == true))
ints.add(counter2);