title: Is there possibility of sum of ArrayList without looping
body: <p>Is there possibility of sum of <code>ArrayList</code> without looping?</p>
  
  <p>PHP provides <code>sum(array)</code> which will give the sum of array.</p>
  
  <p>The PHP code is like</p>
  
  <pre><code>$a = array(2, 4, 6, 8);
  echo "sum(a) = " . array_sum($a) . "\n";
  </code></pre>
  
  <p>I wanted to do the same in Java:</p>
  
  <pre><code>List tt = new ArrayList();
  tt.add(1);
  tt.add(2);
  tt.add(3);
  </code></pre>