public class ExerTest {
@Test
public void test(){
ArrayList arrayList = new ArrayList();
arrayList.add(1);
arrayList.add(2);
arrayList.add(3);
updateList(arrayList);
System.out.println(arrayList);
}
private static void updateList(ArrayList arrayList){
// arrayList.remove(2);//[1, 2]
arrayList.remove(new Integer(2));//[1,3]
}
}
remove(int index)与remove(Object obj)区别
最新推荐文章于 2021-09-24 22:36:37 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)