Сумма и массив Java
int sum = (list.stream().
mapToInt(i -> i.intValue()).sum()
Kirk-Patrick Brown
int sum = (list.stream().
mapToInt(i -> i.intValue()).sum()
int sum = list.stream().mapToInt(Integer::intValue).sum();
double sum = 0;
for(int i = 0; i < m.size(); i++)
sum += m.get(i);
return sum;
//If you have a List<Integer>
int sum = list.stream().mapToInt(Integer::intValue).sum();
//If it's an int[]
int sum = IntStream.of(a).sum();