欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

[转]JAVA中List&Set转换

程序员文章站 2024-01-09 17:19:59
...
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