List类型与String数组、Set集合互相转换

List--->String[ ]

String[ ] array = (String[ ])list.toArray(new String[list.size( )]);

String[ ]--->List

List<String> list = Arrays.asList(array);

List--->Set

Set set = new HashSet(list);

或set.addAll(list);

Set--->List

List list = new ArrayList(set);

或list.addAll(set);

你可能感兴趣的:(List类型与String数组、Set集合互相转换)