Is there possibility of sum of ArrayList without looping?
ArrayList
PHP provides sum(array) which will give the sum of array.
sum(array)
The PHP code is
Once java-8 is out (March 2014) you'll be able to use streams:
If you have a List
List
int sum = list.stream().mapToInt(Integer::intValue).sum();
If it's an int[]
int[]
int sum = IntStream.of(a).sum();