数组和List互转

数组转List

1
2
3
4
5
6
// 把当前整体的对象转成一个集合
// int[] array = new int[] {1,2,3,4,5};
// List<int[]> ints = Arrays.asList(array);

// 把多个元素转成对应的List
List<Integer> ins = Arrays.asList(1,2,3,4,5);

List转数组

1
Object[] obj = ins.toArray();