Java BigDecimal Add addBigDecimalsInMap(Map baseMap, Map addMap)

Here you can find the source of addBigDecimalsInMap(Map baseMap, Map addMap)

Description

add Big Decimals In Map

License

Creative Commons License

Declaration

public static void addBigDecimalsInMap(Map<String, Object> baseMap, Map<String, Object> addMap) 

Method Source Code


//package com.java2s;
/*//from   w ww. j  a v a2 s  . com
 * This software is in the public domain under CC0 1.0 Universal plus a
 * Grant of Patent License.
 *
 * To the extent possible under law, the author(s) have dedicated all
 * copyright and related and neighboring rights to this software to the
 * public domain worldwide. This software is distributed without any
 * warranty.
 *
 * You should have received a copy of the CC0 Public Domain Dedication
 * along with this software (see the LICENSE.md file). If not, see
 * <http://creativecommons.org/publicdomain/zero/1.0/>.
 */

import java.math.BigDecimal;

import java.util.*;

public class Main {
    public static void addBigDecimalsInMap(Map<String, Object> baseMap, Map<String, Object> addMap) {
        if (baseMap == null || addMap == null)
            return;
        for (Map.Entry<String, Object> entry : addMap.entrySet()) {
            if (!(entry.getValue() instanceof BigDecimal))
                continue;
            BigDecimal addVal = (BigDecimal) entry.getValue();
            Object baseObj = baseMap.get(entry.getKey());
            if (baseObj == null || !(baseObj instanceof BigDecimal))
                baseObj = BigDecimal.ZERO;
            BigDecimal baseVal = (BigDecimal) baseObj;
            baseMap.put(entry.getKey(), baseVal.add(addVal));
        }
    }
}

Related

  1. add(Vector a, Vector b)
  2. add2Abs(BigDecimal aValue1, BigDecimal aValue2)
  3. addBigDec(BigDecimal b1, BigDecimal b2)
  4. addBigDecimal(BigDecimal a, BigDecimal b)
  5. addBigDecimals(String value1, String value2)
  6. addPercent(BigDecimal price, double amount)
  7. addQtde(BigDecimal val1, BigDecimal val2)
  8. addSalePrice(Map complexSalePrice, BigDecimal saleprice)
  9. addToBigDecimalInMap(Map theMap, K mapKey, BigDecimal addNumber)