title: How to change add() in Treeset
body: <p>I want to implement union by using <code>add()</code> method in Treeset.</p>
  
  <p>I write like this:</p>
  
  <pre><code>Set&lt;Integer&gt; union(Set&lt;Integer&gt; a, Set&lt;Integer&gt; b) {
      Treeset result = new Treeset();
      for(Integer i:a) {
          result.add(i);
      }
      for(Integer i:b) {
          result.add(i);
      }
      return result;
  }
  </code></pre>
  
  <p>This is one of my Homework and our professor says we cannot use <code>add()</code> method, so, how I can use another way to implement it and get the same result?</p>