title: What is the difference between Collection.add() method and Collection.addAll() method in Collections in Java
body: <p>I have two <code>ArrayList</code>s (<code>a1</code> and <code>a2</code>) as below:</p>
  
  <pre><code>ArrayList a1 = new ArrayList();
  a1.add(8);
  a1.add("a1");
  
  ArrayList a2 = new ArrayList();
  a2.add(a1); //output : [[8, a1]]
  a2.addAll(a1); //output : [[8, a1], 8, a1]
  </code></pre>
  
  <p>My Questions:</p>
  
  <ol>
  <li>Why does <code>a2.addAll()</code> method prints the data twice?</li>
  <li>What is the exact difference between <code>add</code> and <code>addAll</code>? Both the methods return boolean.</li>
  </ol>