Map<Long, AreaInfo> cityCollect = list.stream().collect(Collectors.toMap(AreaInfo::getCityId, po -> po, (key, key2) -> key2));
Map<Long, AreaInfo> cityCollect = list.stream().collect(Collectors.toMap(AreaInfo::getCityId, po -> po));
两者有区别,建议第一中,第二种会有报错,抛出异常