get Total of Long value List - Java Collection Framework

Java examples for Collection Framework:List

Description

get Total of Long value List

Demo Code


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

public class Main {


    public static long getTotal(List<Long> times) {
        long total = 0;
        for (Long time : times) {
            total = total + time;/*  w  w w .  j  av  a  2s . c  o  m*/
        }
        return total;
    }
}

Related Tutorials