1、将list集合对象的某个字段属性查询出来转成新的 list:
List<String> deptIds = deptEntityList.stream().map(SysDeptVo::getId).collect(Collectors.toList());
2、根据list集合对象的特定属性转map集合:
Map<String,String> connectFlagMap = connectDeviceList.stream().collect(Collectors.toMap(DeviceInfoConnectEntity::getDeviceNum, DeviceInfoConnectEntity::getConnectFlag));
Map<String,DeviceInfoVersionEntity> deviceInfoVersionEntitysMap = deviceVersions.stream().filter(Objects::nonNull).collect(Collectors.toMap(DeviceInfoVersionEntity::getDeviceNum, d -> d, (d1, d2) -> { return d2; }));