1、数组转List:
String[] countries = {"Array", "List", "Set", "Map"};
List list = Arrays.asList(countries);
2、Array转:Set
String [] countries = {"Array", "List", "Set"};
Set set = new HashSet(Arrays.asList(countries));
System.out.println(set);
3、List转Array:
List list = new ArrayList();
list.add("Array");
list.add("List");
list.add("Set");
list.add("Map");
String [] countries = list.toArray(new String[list.size()]);
4、Map转List:
List list = new ArrayList(map.values());
5、Map转Set:
Map map = createMap();
Set set = new HashSet<>(map.values());
6、List转Set:
String[] staffs=new String[]{"Array", "List", "Set"};
List staffsList = Arrays.asList(staffs);
Set result = new HashSet(staffsList);