for (final Prices ppr : prices) {
if (!currency.getCode().equals(ppr.getCurrency().getCode())) {
continue;
}
return ppr.getPrice();
}
上面的代码可以转成Java流代码吗? continue
关键字出现错误...
最佳答案
return prices.stream()
.filter(ppr -> currency.getCode().equals(ppr.getCurrent().getCode()))
.findFirst()
.orElseThrow(NoSuchElementException::new);
关于java - Java流中continue关键字的等价物?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37658399/