suma arraylist Java 8
int total = numbers.stream().mapToInt(i -> i.intValue()).sum();
System.out.print(total);
Ugliest Unicorn
int total = numbers.stream().mapToInt(i -> i.intValue()).sum();
System.out.print(total);
//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();