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
Then write it yourself:
public int sum(List list) { int sum = 0; for (int i : list) sum = sum + i; return sum; }