java中指定删除list对应元素

	public static void rmListtest(){
		String str[] = {"1","2","3","4","5","6","7","8"};
		List list = new ArrayList();
		for(int i=0; i=0; j--){
			list.remove(pos[j]);
			System.out.println(list);
		}
		System.out.println("=========================");
		list = new ArrayList();
		for(int i=0; i

结果:

[1, 2, 3, 4, 5, 6, 7, 8]
[1, 2, 3, 4, 5, 6, 7]
[1, 2, 3, 4, 5, 6]
[1, 2, 3, 4, 5]
[1, 2, 3, 5]
[1, 2, 5]
=========================
[1, 2, 3, 4, 5, 6, 7, 8]
[1, 2, null, 4, 5, 6, 7, 8]
[1, 2, null, null, 5, 6, 7, 8]
[1, 2, null, null, 5, null, 7, 8]
[1, 2, null, null, 5, null, null, 8]
[1, 2, null, null, 5, null, null, null]


你可能感兴趣的:(java)