java8 流stream开发说明

List<Model> modelList = list.stream().filter(e -> !e.getId().equals(model.getId())).collect(Collectors.toList());

        if(CollectionUtil.isNotEmpty(modelList)){
            List<Model> models = modelList.stream().filter(e -> e.getKey().equals(key)).collect(Collectors.toList());
            if(CollectionUtil.isNotEmpty(models)){
                return R.fail("模型KEY已存在");
            }
        }

排序

list.stream().sorted(Comparator.comparing(HistoricTaskInstance::getEndTime, Comparator.nullsFirst(Date::compareTo))).collect(Collectors.toList());

排序

List<Comment> taskComments = taskService.getTaskComments(historicTaskInstance.getId());

        if(CollectionUtil.isNotEmpty(taskComments)){
            actHistoryInfoVo.setCommentId(taskComments.get(0).getId());
            String message = taskComments.stream()
                .map(Comment::getFullMessage).collect(Collectors.joining("。"));
            if (StringUtils.isNotBlank(message)) {
                actHistoryInfoVo.setComment(message);
            }
        }

翻译

    if (CollUtil.isNotEmpty(actHistoryInfoVoList)) {
        List<Long> assigneeList = actHistoryInfoVoList.stream().map(e -> Long.valueOf(e.getAssignee())).collect(Collectors.toList());
        if (CollUtil.isNotEmpty(assigneeList)) {
            List<SysUser> sysUsers = iUserService.selectListUserByIds(assigneeList);
            actHistoryInfoVoList.forEach(e -> {
                sysUsers.stream().filter(u -> u.getUserId().toString().equals(e.getAssignee())).findFirst().ifPresent(u -> {
                    e.setNickName(u.getNickName());
                });
            });
        }
    }

标签: none

相关阅读

  • 测试信息
  • 开发商:阿里巴巴
  • 版本号:1.0
  • 配色:(企业家)” 推选活动结果
  • 测试信息
  • 测试信息
  • 测试信息