java how to sum values of arraylist code example
Example 1: sum of arraylist java 8
int total = numbers.stream().mapToInt(i -> i.intValue()).sum();
System.out.print(total);
Example 2: inbuild method to sum of an arraylist elements in java
doubleList.stream().reduce((a,b)->a+b).get();