Java List Sum getListSum(List list)

Here you can find the source of getListSum(List list)

Description

Return sum of all list entries

License

Open Source License

Return

sum of all list entries

Declaration

public static Integer getListSum(List<Integer> list) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    /**// www  .j  a  v a 2  s  .c o m
     * Return sum of all list entries
     * @return sum of all list entries
     */
    public static Integer getListSum(List<Integer> list) {
        Integer result = null;

        if (list.size() > 0) {
            result = 0;
            for (Integer value : list) {
                result += value;
            }
        }

        return result;
    }
}

Related

  1. addByteToMessage(final List message, final byte bytevalue, final int checksum)
  2. adjustSumOfSquareValue(List oper, Number adjustedOper1)
  3. calculateSum(List valueList)
  4. checkSum(List stringList)
  5. getResidualSumOfSquares(List response, List samples, int ta)
  6. getSum(final List values)
  7. getSum(List numList)
  8. getSum(List values)