stream.sort对空值排序的时候会报错,所以需要先设置空值排序规则
List<BillServiceTotalMonthResponse> result = totalMonthResponses.stream()
.sorted(Comparator.nullsLast(Comparator.comparing(BillServiceTotalMonthResponse::getServiceRealName,
Comparator.nullsLast(Collator.getInstance(Locale.CHINA))))).collect(Collectors.toList());