Check out example codes for "sum of arraylist java 8". It will help you in understanding the concepts better.

Code Example 1

int total = numbers.stream().mapToInt(i -> i.intValue()).sum();
		System.out.print(total);

Learn ReactJs, React Native from akashmittal.com