java filter 自定义条件

  private Boolean sameStatus(Integer sourceCompared, Integer targetCompared) {
        if (Func.isNull(sourceCompared)) {
            return true;
        }
        return Func.equals(sourceCompared, targetCompared);
    }

 List<RemarkConfiguredVO> subList = list.stream().filter(e -> Func.equals(parent.getId()
                    , e.getParentId()) && sameStatus(param.getStatus(), e.getStatus())).collect(Collectors.toList());

 

posted @ 2022-09-27 14:40  八英里  阅读(196)  评论(0编辑  收藏  举报