JDK1.8 characteristics (update ..)

“15,5,9,17,99,107,47”转List<Long>

List<Long> linkCompanyIds = Arrays.asList("15,5,9,17,99,107,47".split(",")).stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());

15, 16, 1, 89, 9, 89, 9, 16, 15 to weight transfer sorted List <Integer>

List<Integer> list = Arrays.asList(15, 16, 1, 89, 9, 89, 9, 16, 15);
list.stream().distinct().sorted((Integer s1, Integer s2) -> s1 - s2).forEach(System.out::println);

 

Guess you like

Origin www.cnblogs.com/charkey/p/10953550.html