如何在每次循环后更改我的变量。我需要将声明的arraylist 变量放在代码标记为“HERE”的位置。
//variables i need to cycle through
static ArrayList<Integer> one1,two1,one2,two2=new ArrayList<>();
for(int i=0;i<4;i++){
for(int j=0;j<word1[i].length();j++){
if (word1[i].charAt(j)=='-'){
HERE.add(j);
} else if (word1[i].charAt(j)!='-') {
HERE.add(null);
}
}
}
有没有一种简单的方法可以在没有几十行代码的情况下做到这一点?