Java BigDecimal Add sumBig(final Collection values)

Here you can find the source of sumBig(final Collection values)

Description

sum Big

License

Open Source License

Declaration

public static BigDecimal sumBig(final Collection<? extends BigDecimal> values) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2015, 2017 Lablicate GmbH.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*w w  w . j a  v a 2s.  c o m*/
 * Dr. Alexander Kerner - initial API and implementation
 *******************************************************************************/

import java.math.BigDecimal;

import java.util.Collection;

public class Main {
    public static BigDecimal sumBig(final Collection<? extends BigDecimal> values) {

        final BigDecimal result = BigDecimal.ZERO;
        for (final BigDecimal n : values) {
            result.add(n);
        }
        return result;
    }

    /**
     * Add one {@link Integer} to another.
     *
     * @param integer1
     *            first {@link Integer}
     * @param integer2
     *            second {@link Integer}
     * @return sum of {@code integer1} and {@code integer2}
     */
    public static Integer add(final Integer integer1, final Integer integer2) {

        return Integer.valueOf(integer1.intValue() + integer2.intValue());
    }
}

Related

  1. addVatAmount(BigDecimal percentage, BigDecimal amount)
  2. sum(BigDecimal num1, BigDecimal num2, int scale)
  3. sum(BigDecimal[] bigDecimalNumbers)
  4. sum(final List list)
  5. sum(List numbers)
  6. sumBigDecimal(List vector)
  7. sumCurrencyMap(Map> destMap, Map> mapToSum)