判断一个值在list中对象的某一属性是否拥有

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 21:05   5571   0

判断i的值在basicWindPowerList中是否拥有,如果没有进入if判断里面的逻辑

for (double i = 0; i <= 25; i += 0.5){
    String index = String.valueOf(i);
    if (!basicWindPowerList.stream().filter(w->String.valueOf(w.getWind()).equals(index)).findAny().isPresent()){
        Double d =  basicWindPowerService.getShouldPowerByWPPairs(basicWindPowerList,i);
        BigDecimal power = new BigDecimal(d);
        BigDecimal p = power.setScale(1,BigDecimal.ROUND_HALF_DOWN);
        BasicWindPower basicWindPower = new BasicWindPower();
        basicWindPower.setPower(p);
        basicWindPower.setWind(BigDecimal.valueOf(i));
        basicWindPower.setSchemeId(schemeId);
        basicWindPowerList.add(basicWindPower);
    }
}

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875873
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP