java stream List排序,List去重
ListMap排序(stream)
list.stream().sorted(Comparator.comparing(map -> Integer.parseInt(map.get("monthtime").toString()))).collect(Collectors.toList());
List<Map<String, Object>> lista = list.stream().sorted(Comparator.comparing(map -> Integer.parseInt(map.get("aa").toString()))).collect(Collectors.toList());
List<Map<String, Object>> sScore = lstMap.stream().sorted(
Comparator.comparing(
m -> {
BigDecimal sScore1 = Convert.toBigDecimal(m.get("sScore").toString());
return sScore1;
})
).collect(Collectors.toList());
Collections.reverse(sScore);
List去重
List<String> lstResult = new ArrayList<>();
List<String> lstHouseId = new ArrayList<>();
lstResult = lstHouseId.stream().distinct().collect(Collectors.toList());
Collectors.toMap()
https://blog.csdn.net/qq_33204709/article/details/128058684
转字符串
List<Long> lstCompanyIds = Arrays.asList(1L, 2L, 3L, 4L, 5L);
String result = lstCompanyIds.stream().map(Object::toString).collect(Collectors.joining(","));
lstCompanyIds.stream().map(String::valueOf).collect(Collectors.joining(","));
择善人而交,择善书而读,择善言而听,择善行而从。