1.List里面是map
List<Map<String, String>> list = new ArrayList<>();
// 返回结果为map<expertId, map<String,String>>
list.stream().collect(Collectors.toMap(map -> map.get("expertId"), a -> a, (k1, k2) -> k1));
// 返回结果为map<expertId,interviewCount>
list.stream().collect(Collectors.toMap(s -> s.get("expertId"), s -> s.get("interviewCount")));
2.List里面是实体类
List<ClientBill> list1 = new ArrayList<>();
// 返回结果为map<id, ClientBill>
list1.stream().collect(Collectors.toMap(ClientBill::getId, a -> a, (k1, k2) -> k1));
// 返回结果为map<id, clientId>
list1.stream().collect(Collectors.toMap(ClientBill::getId, ClientBill::getClientId));