//int數組轉set集合
//1.轉換成stream,2.包裝,3.stream轉Set
Set<Integer> set= Arrays.stream(array).boxed().collect(Collectors.toSet());
//錯誤舉例,array元素需爲包裝類
Set<Integer> set=new HashSet<>(Arrays.asList(array));
//List<Integer> 轉 int[]
//1.list轉換成stream,2.轉換爲int流,3.轉換爲int[].
int[] array=list.stream().mapToInt(Integer::valueOf).toArray();
//String[]優雅地轉int[]
//String[]->stream->integer stream->int[]
int[] ints=Arrays.stream(strings).mapToInt(Integer::valueOf).toArray();