Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Collection;
import java.util.Iterator;

public class Main {
    public static long getSum(Collection<? extends Number> collection) {
        Iterator<? extends Number> iterator = collection.iterator();
        long sum = 0;
        while (iterator.hasNext()) {
            sum += iterator.next().longValue();
        }

        return sum;
    }
}