Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Map;

public class Main {
    /**
     * Sums up all the associated values from the specified
     * <code>map</code>
     * @param map
     * @return
     */
    public static <K> double sum(Map<K, ? extends Number> map) {
        double sum = 0.0;
        for (Number value : map.values()) {
            sum += value.doubleValue();
        }

        return sum;
    }
}