title: Sum of double value in a List using Lambda from Java 8
body: <p>I want to iterate through the list of Accounts, and sum up the Double credit amount using <strong>Java 8 lambda feature</strong>. Any ideas?</p>
  
  <pre><code>import lombok.*;
  import java.util.List;
  
  @Data
  public class Account {
  
  private Double amount;
  @Getter(AccessLevel.NONE)
  private Boolean active;
  private String companyCode;
  private Long accountNumber;
  
      public Boolean isActiveAccount() {
          return active;
      }
  }
  </code></pre>
  
  <p>I have a List of Accounts, I want to sum the credit amount using the Lambda Java 1.8 feature, how do I go about that, instead of the traditional approach that I have shown below?</p>
  
  <pre><code>//Lets pretend that the list has 3000 account-elements.
  List&lt;Account&gt; accountsList = new ArrayList&lt;&gt;();
  
  Double totalAmount = 0.0;
  
  for (Account account : accountsList) {
      Double accAmountList = account.getAmount();
      if(null != accAmountList) totalAmount += accAmountList;
  }
  </code></pre>