数组转集合,List和set互转

数组转集合

String[] s = new String[]{"A", "B", "C", "D","E"};

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

List Set互转

List转Set
Set<String> set = new HashSet<>(list);
Set转List
List<String> list_1 = new ArrayList<>(set);


 

posted on 2022-07-11 13:17  隔壁老王(加速版)  阅读(120)  评论(0)    收藏  举报