public static void main(String[] args) { int[] nums = { 5, 6, 6, 6, 8, 8, 7 }; List<Integer> numList = new ArrayList<Integer>(); for (int i : nums) numList.add(i); Set<Integer> numSet = new HashSet<Integer>(); numSet.addAll(numList); System.out.println(numSet); }
时间: 2024-10-15 06:14:08