Skip to content

Instantly share code, notes, and snippets.

@wkdalsgh192
Created September 8, 2021 01:25
Show Gist options
  • Save wkdalsgh192/7c7bc80e85b3defcd9615b97ba4b9911 to your computer and use it in GitHub Desktop.
Save wkdalsgh192/7c7bc80e85b3defcd9615b97ba4b9911 to your computer and use it in GitHub Desktop.
public class Orders {
private final List<Order> orders;
public Orders(List<Order> orders) {
this.orders = orders;
}
public long getAmountSum() {
return orders.stream()
.mapToLong(Order::getAmount)
.sum();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment