Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.List;

public class Main {
    public static int sum(List<Integer> list) {

        if (list == null) {
            throw new IllegalArgumentException("Can't sum values for NULL list");
        }

        return list.stream().parallel().reduce(0, (sum, val) -> sum + val);

    }
}