【发布时间】:2020-05-11 20:04:12
【问题描述】:
我正在尝试使用 ArrayList 的 remove(Object o) 来删除一个 int 数组,但这不是删除。如何用 remove(Object o) 删除 int 数组?
package remove;
import java.util.ArrayList;
public class Test{
public static void main(String args[]) {
ArrayList<int[]> test = new ArrayList<int[]>();
test.add(new int[] {0,1});
test.add(new int[] {0,2});
test.add(new int[] {0,3});
test.add(new int[] {0,4});
test.add(new int[] {0,5});
test.add(new int[] {0,6});
test.add(new int[] {0,7});
test.remove(new int[] {0,4});
for(int i=0; i<test.size(); i++) {
System.out.println(test.get(i)[0] + " " + test.get(i)[1]);
}
}
}
这已经结束了:
0 1
0 2
0 3
0 4
0 5
0 6
0 7
【问题讨论】:
-
试试 test.remove(3);