Java BigDecimal getTotalSum(List subTotals)

Here you can find the source of getTotalSum(List subTotals)

Description

Sum a list of sub totals to yield a total sum

License

Apache License

Parameter

Parameter Description
subTotals A list of sub totals in BigDecimal

Return

Total summed amount of the BigDecimal in the given list

Declaration

public static BigDecimal getTotalSum(List<BigDecimal> subTotals) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;
import java.util.List;

public class Main {
    /**//from w ww  . ja va 2s  .c om
     * Sum a list of sub totals to yield a total sum
     * 
     * @param subTotals
     *            A list of sub totals in BigDecimal
     * @return Total summed amount of the BigDecimal in the given list
     */
    public static BigDecimal getTotalSum(List<BigDecimal> subTotals) {
        BigDecimal totalSum = new BigDecimal("0.00");
        subTotals.forEach(subTotal -> totalSum.add(subTotal));
        return totalSum;
    }
}

Related

  1. getScale(BigDecimal bd1, BigDecimal bd2)
  2. getScaledDouble(BigDecimal input)
  3. getSid(BigDecimal total, AtomicLong sid)
  4. getSignedBalance(BigDecimal balance)
  5. getTensVal(BigDecimal val)
  6. getUnscaledBytes(BigDecimal bd)
  7. getUpdateAccountsQuery(BigDecimal[] result, int id)
  8. getUserLink(BigDecimal id, String name)
  9. getValue(BigDecimal value, Class clazz)