数组和集合转化 array与list
package com.chen.test;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class Test {
public static void main(String [] args)
{
System.out.println("你好");
Integer [] arrs=new Integer[]{1,3,4,6,6};
//打印
System.out.println(Arrays.toString(arrs));
//转化List
List<Integer> integers = Arrays.asList(arrs);
System.out.println(integers);
//转化数组
Integer[] integers1 = integers.toArray(new Integer[0]);
System.out.println(Arrays.toString(integers1));
//基本数组转化集合
int [] arrs2={9,6,3,5,7};
List<Integer> collect = Arrays.stream(arrs2).boxed().collect(Collectors.toList());
System.out.println(collect);
//多参数转化集合
List<? extends Serializable> list = Arrays.asList("你好",1000, 500);
System.out.println(list);
}
}