I was wondering what the best way to sum the elements of an integer list in java is.
I'm aware I could perform this with a for loop but I was expecting there might be inbuilt ways to do this, such as the reduce function in other languages.
The relevant code for this problem has been provided below.
public static int sumList(List<Integer> list) {
return 0; //should return sum of integers in list
}