List<Integer> integerList = Arrays.asList(4, 5, 2, 3, 7, 9); List<Integer> collect = integerList.stream() .map(i -> i * i).distinct() .collect(Collectors.toList()); // Collections.sort(collect); //升序 collect.sort(Comparator.reverseOrder()); //倒序 collect.forEach(System.out::println);