Set转List:
HashSet<Long> set = new HashSet<>();
ArrayList<Long> longs = new ArrayList<>(set);
List转Set:
List<String> strings1 = new ArrayList<>();
Set<Object> objects = new HashSet<>(strings1);
数组转List: (小提示:数组因为已经固定大小,所以转成List后不能做增删add、remove等操作,会报异常的)
String[] strings = {"a", "b", "c"};
List<String> strings1 = Arrays.asList(strings);
List转数组:
List<String> strings1 = new ArrayList<>();
Object[] objects = strings1.toArray();
数组转Set :
String[] strings = {"a", "b", "c"};
HashSet<String> stringHashSet = new HashSet<>(Arrays.asList(strings));