我有这行代码
test.remove(Arrays.asList(test).indexOf(großezahl))
实际上,我想删除名为 ''test'' 的 ArrayList 中出现的 ''großezahl''。问题是,每次我尝试这段代码时,我都遇到了同样的问题
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
也许有更好的方法来解决这个问题,但这真的让我很烦恼。如果有人想尝试我的例子,''test'' 是 [2, 3, 4] 和 ''großezahl'' 是 3。ArrayList 也只包含整数。
提前致谢。
GCT1015
一只甜甜圈
相关分类