activiti Stream之list转map及问题解决

List集合转Map,用到的是Stream中Collectors的toMap方法:Collectors.toMap
具体用法实例如下:

    public TableDataInfo modelList(Integer pageNum, Integer pageSize){
    TableDataInfo tableDataInfo = new TableDataInfo();
    Long count = repositoryService.createProcessDefinitionQuery().count();
        List <ProcessDefinition> processDefinitionList = repositoryService.createProcessDefinitionQuery()
                .latestVersion()
                .listPage(pageNum-1,pageSize);
        List<Map<String,String>> list= processDefinitionList.stream().map( (s)-> {
            Map<String,String> map = new HashMap <>();
            map.put("name",s.getName());
            map.put("des",s.getDescription());
            map.put("version",String.valueOf(s.getVersion()));
            map.put("key",s.getKey());
            map.put("id",s.getId());
            return map;
        }).collect(Collectors.toList());
                tableDataInfo.setRows(list);
                tableDataInfo.setTotal(count);
        return tableDataInfo;
    }