Set<Long> stageTypeIds = list.stream().map(ClueAllocateStageConfig::getStageTypeId).collect(Collectors.toSet()); ClueAllocateStageSettingExample example = new ClueAllocateStageSettingExample(); ClueAllocateStageSettingExample.Criteria criteria = example.createCriteria(); criteria.andIdIn(stageTypeIds.stream().collect(Collectors.toList())); criteria.andStatusEqualTo(StatusEnum.ENABLE); criteria.andDelFlagEqualTo(DelFlagEnum.NOT_DELETE); List<ClueAllocateStageSetting> settingList= clueAllocateStageSettingMapper.selectByExample(example).stream().collect(Collectors.toList()); Map<Long, String> stageTypeNameMap =null; if(!_CollectionUtils.isEmpty(settingList)){ stageTypeNameMap= settingList.stream().collect(Collectors.toMap(ClueAllocateStageSetting::getId, ClueAllocateStageSetting::getSettingName)); }
整行转map
Map<Long, ClueAllocateStageSetting> clueAllocateStageSettingMap=
settingList.stream().collect(Collectors.toMap(ClueAllocateStageSetting::getId,
Function.identity()));
String 转list:
List<ScopeApplicationResDTO> copeApplicationList = JSON.parseArray(item.getScopeApplication(), ScopeApplicationResDTO.class);
取列表里的某一列当数组,并且需要OrderId转换类型为String:
List<String> list = mockList().stream()
.map(LogisticsUionCustomerIdBO::getOrderId)
.map(String::valueOf)
.collect(Collectors.toList());
System.out.println("list转换为String类型=" + list);
662

被折叠的 条评论
为什么被折叠?



