I'm trying to sum an array of Integers. I red @ZouZou 's solution from this question and can't get it to work
int [] arr = {1,2,3,4};
int sum = Arrays.stream(arr).sum(); //prints 10
I've got
public static void proc(Integer[] v) {
int sum = Arrays.stream(v).sum();
and the compiler gives "cannot find symbol method sum".
What is the problem? Is doing it this way any faster than summing with a loop?