title: How to work with Java ArrayList?
body: <p>Please, I try to add item to arrayList like example below:</p>
  
  <pre><code>ArrayList&lt;Integer&gt; list = new ArrayList&lt;&gt;();
  
  list.add(2);
  list.add(5);
  list.add(7);
  
  for(int i : list ){
      if((i%2) == 0){
           list.add(i*i);
      }
  }
  </code></pre>
  
  <p>but it throws an exception </p>
  
  <pre><code>java.util.ConcurrentModificationException
  </code></pre>
  
  <p>Could you please advice how can I add item like this or what kind of list (container) is to be used correctly?</p>