title: In Java, how to make a method able to accept variadic parameters or Set of parameters without duplicating the code of implementation?
body: <p>I'm looking for a way so that I can use the same portion of code to deal with parameter passing through Set or variadic parameters. e.g. </p>
  
  <pre><code>public void func(String...strs){
      for (String str : strs){
          //Deal with str
      }
  }
  </code></pre>
  
  <p>According to the spec, the func will also supports:</p>
  
  <pre><code>public void func(Set&lt;String&gt; strs){
      for (String str : strs)
          //Deal with str
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Both the processing code are identical, how can I merge to a single implementation? Please kindly advise.</p>
  
  <p>Thank you.</p>
  
  <p>Regards,
  William</p>