Here you can find the source of addSalePrice(Map
private static void addSalePrice(Map<String, BigDecimal> complexSalePrice, BigDecimal saleprice)
//package com.java2s; import java.math.BigDecimal; import java.util.Map; public class Main { private static String saleKey = "SalePrice"; private static void addSalePrice(Map<String, BigDecimal> complexSalePrice, BigDecimal saleprice) { if (!complexSalePrice.containsKey(saleKey)) { complexSalePrice.put(saleKey, saleprice); } else {/*ww w . j av a 2s .c om*/ BigDecimal existedPrice = complexSalePrice.get(saleKey); BigDecimal priceResult = existedPrice == null ? BigDecimal.ZERO : existedPrice; complexSalePrice.put(saleKey, priceResult.add(saleprice)); } } }