Java中list和数组的互换

1.数组转list

List<int> a = new ArrayList<int>();
int[] b = new int(a.size());
int[] c = a.toArray(b);

2.list转数组

String[] strg = {"1","2"};
List<String> b = Arrays.asList(strg);

 

posted on 2017-06-23 16:18  寻梦撑一支长蒿  阅读(235)  评论(0编辑  收藏  举报

导航

干嘛呢你,快把手拿开