Java tutorial
//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); } }