list Sum - Android java.util

Android examples for java.util:List Algorithm

Description

list Sum

Demo Code


//package com.java2s;
import java.util.List;

public class Main {
    public static int listSum(List<Integer> list) {
        int sum = 0;
        for (int n : list) {
            sum += n;//from   ww w.j av  a2  s  .c om
        }
        return sum;
    }
}

Related Tutorials