title: Generic variable number of parameter passing in java
body: <p>I have a method findByProperties(Parameter... p); so it can take any number of parameters. But what I am confused is if I had to call this method and I do not know the number of parameters how do I do that</p>
  
  <p>suppose I have a list with parameters, and the size of the list changes each time you call the method, the how would I add the parameters from the list to the method call?</p>
  
  <pre><code>for(ArrayList&lt;Parameter&gt; p : list){
     findByProperties(p);  //not sure what to do here
   }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>this was the solution:</p>
  
  <pre><code>Parameter[] paramArray = new ArrayList&lt;Parameter&gt;().toArray(new Parameter[]{});
  findByProperties(paramArray);
  </code></pre>