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
You can use GNU Trove library:
TIntList tt = new TIntArrayList(); tt.add(1); tt.add(2); tt.add(3); int sum = tt.sum();