[转]JAVA中List&Set转换

JAVA中List&Set转换

list = new ArrayList(new Hashset());// Fixed-size list

List list = Arrays.asList(array);// Growable list
list = new LinkedList(Arrays.asList(array));// Duplicate elements are discarded

Set set = new HashSet(Arrays.asList(array));
List list = new ArrayList();
Set set = new ArraySet(list);
Set set = new ArraySet();
List list = new ArrayList(set);
 

你可能感兴趣的:(java)