for (final Prices ppr : prices) {
if (!currency.getCode().equals(ppr.getCurrency().getCode())) {
continue;
}
return ppr.getPrice();
}
Can the code above be converted into Java stream code? I am getting an error with the continue keyword...
return prices.stream()
.filter(ppr -> currency.getCode().equals(ppr.getCurrent().getCode()))
.findFirst()
.orElseThrow(NoSuchElementException::new);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With