Here you can find the source of getTotalSum(List
Parameter | Description |
---|---|
subTotals | A list of sub totals in BigDecimal |
public static BigDecimal getTotalSum(List<BigDecimal> subTotals)
//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; } }