Skip to content

Instantly share code, notes, and snippets.

@zivce
Created September 25, 2020 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zivce/c3750840d0c4c9f20d2e56f9c2498aae to your computer and use it in GitHub Desktop.
Save zivce/c3750840d0c4c9f20d2e56f9c2498aae to your computer and use it in GitHub Desktop.
return Optional.ofNullable(discounts)
.map(Collection::stream)
.orElseGet(Stream::empty)
.map(DiscountValue::getAppliedValue)
.reduce(itemPrice, (price, discount) -> price - discount);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment