JDK8 使用总结

// 统计还款本金
BigDecimal repayPrincipleAmount = preReturnInfoResponList.stream().map(PreReturnInfoRespon::getRepayPrinciple).reduce(BigDecimal.ZERO, BigDecimal::add);

// 分组统计 Group InterestInfo by name
Map<String, List<InterestInfo>> totalGroup = totalInterestInfos.stream()
.collect(Collectors.groupingBy(InterestInfo::getName));

// 比较对象,指定字段
QueryBindCardInfoResponse grcBindCardInfo = new QueryBindCardInfoResponse();
        grcBindCardInfo.setUserNo(userAppInfo.getUserId());
        grcBindCardInfo.setUserName(userAppInfo.getClientName());
        grcBindCardInfo.setIdCard(bankCard.getAccount());
        grcBindCardInfo.setMobile(bankCard.getRelationMobile());
        // TODO 设置 fundCode
        String[] excludeFields = {"secondaryAccount", "bindTime"};

        List<QueryBindCardInfoResponse> dataList = bankCardCore.bindCardQuery(userAppInfo.getUserId(), null);
        boolean containCard = dataList.stream()
                .anyMatch(data -> (EqualsBuilder.reflectionEquals(data, grcBindCardInfo, excludeFields)));

  

 

posted on 2018-11-16 08:45  runmove  阅读(351)  评论(0编辑  收藏  举报