Here you can find the source of sum(final List extends Number> list)
Parameter | Description |
---|---|
list | the list |
public static double sum(final List<? extends Number> list)
//package com.java2s; /*//from w w w . j a v a2s .c om * Title: CloudSim Toolkit * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds * Licence: GPL - http://www.gnu.org/copyleft/gpl.html * * Copyright (c) 2009-2012, The University of Melbourne, Australia */ import java.util.List; public class Main { /** * Sums a list of numbers. * * @param list the list * @return the double */ public static double sum(final List<? extends Number> list) { double sum = 0; for (Number number : list) { sum += number.doubleValue(); } return sum; } }