package zuoye;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Zuoye2018012401 {
public static void main(String[] args){
//赋值数组
int q[] = new int[]{1,2,3,4,5,6,7,8,9,10};
System.out.println("原数组:"+Arrays.toString(q));
//将数组值赋给list集合
List<Integer> list = new ArrayList<Integer>();
for (int i=0; i<q.length; i++){
list.add(q[i]);
}
System.out.println("----------");
System.out.println("list集合数据:"+list);
//删除list集合前五个元素
list.remove(0);
list.remove(0);
list.remove(0);
list.remove(0);
list.remove(0);
System.out.println("----------");
System.out.println("删除list集合前五个元素:"+list);
list.remove(2);
list.remove(2);
list.remove(2);
System.out.println("----------");
System.out.println("最终显示:"+list);
}
}
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Zuoye2018012401 {
public static void main(String[] args){
//赋值数组
int q[] = new int[]{1,2,3,4,5,6,7,8,9,10};
System.out.println("原数组:"+Arrays.toString(q));
//将数组值赋给list集合
List<Integer> list = new ArrayList<Integer>();
for (int i=0; i<q.length; i++){
list.add(q[i]);
}
System.out.println("----------");
System.out.println("list集合数据:"+list);
//删除list集合前五个元素
list.remove(0);
list.remove(0);
list.remove(0);
list.remove(0);
list.remove(0);
System.out.println("----------");
System.out.println("删除list集合前五个元素:"+list);
list.remove(2);
list.remove(2);
list.remove(2);
System.out.println("----------");
System.out.println("最终显示:"+list);
}
}