title: how to sum all elements a where elements b are equal
body: <p>I have the following ArrayList:  </p>
  
  <pre><code>a1 b1  
  a2 b2  
  ...  
  an bn
  </code></pre>
  
  <p>And I want to sum all elements <strong>a</strong> where elements <strong>b</strong> are equal. Could you please advise me the best way how it can be done?</p>