import java.io.InputStreamReader;
import java.math.BigDecimal;
//import java.math.MathContext;
//import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
class Main {
public static void main(String args[]) {
List<Map<String, Object>> payInfoList = new ArrayList<>();
List<BigDecimal> tempSumOrgPay = new ArrayList<>();
BigDecimal sumOrgPay = BigDecimal.ZERO;
Map<String, Object> payInfo1 = new HashMap<>();
payInfo1.put("payAgent","ORG");
payInfo1.put("paySeq",0);
payInfo1.put("payDate","20200820");
payInfo1.put("payAmt","3933963630.0000");
Map<String, Object> payInfo2 = new HashMap<>();
payInfo2.put("payAgent","ORG");
payInfo2.put("paySeq",1);
payInfo2.put("payDate","20200820");
payInfo2.put("payAmt","4933763630.0000");
payInfoList.add(payInfo1);
payInfoList.add(payInfo2);
for (Map<String, Object> item : payInfoList) {
BigDecimal payAmt = new BigDecimal(item.get("payAmt").toString());
tempSumOrgPay.add(payAmt);
}
sumOrgPay = tempSumOrgPay.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
System.out.print(sumOrgPay.toString());
}
}
demo : repl.it/talk/share/BigDecimal-Sum-Code-Example/84679