1. 程式人生 > >陣列轉集合,集合轉陣列

陣列轉集合,集合轉陣列

陣列轉集合:

String[] a={"1","2","3","4"};


List list=Arrays.asList(a);

集合轉陣列

List<String> list=new ArrayList<String>();

list.add("aa");

 Object[] ary1 = list.toArray();

 System.out.println(ary1.length);