Map<String, Integer> countMap = listMap.stream().collect(Collectors.toMap(DeviceCountVo::getDeviceClassId, DeviceCountVo::getNum,(o1,o2)->o1));
如上图,转map时存在多个key相同的情况,可以指定取其中之一
Map<String, Integer> countMap = listMap.stream().collect(Collectors.toMap(DeviceCountVo::getDeviceClassId, DeviceCountVo::getNum,(o1,o2)->o1));
如上图,转map时存在多个key相同的情况,可以指定取其中之一