1.list转为set

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

2.set转为list

Set set=new HashSet<>(new ArrayList());

3.数组转为list

int a={1,2,3,4};
 List list=Arrays.asList(a);

4.数组转set

int a={1,2,3,4,5,6};
 Set set=new HashSet<>(Arrays.asList(a));

5.list,set转为数组

toArray()方法将list转为object数组,
 List list=new ArrayList<>();
 Object[] a=list.toArray();
 Object[] b=set.toArray();