1. string->int排序
resultList = totalList.stream().sorted(Comparator.comparing(s::getFinishRate, Comparator.comparingInt(Integer::parseInt)).reversed()).collect(toList());
2.List->Map
#值为对象中的字段
Map<String, String> Map = totalList.stream().collect(Collectors.toMap(s::getOrgId, s::getGridCount, (v1, v2) -> v2));
#值为对象本身
Map<String, WgrbStatistic> map = wgList.stream().collect(Collectors.toMap(WgrbStatistic::getOrgId, item->item));
3.List-> Sum
String count = String.valueOf(resultList.stream().map(s::getCountFinish).mapToInt(Integer::parseInt).sum());
网友评论