Java variadic function parameters
<p>I have a function that accepts a variable number of parameters:</p>

<pre><code>foo (Class... types);
</code></pre>

<p>In which I get a certain number of class types. Next, I want to have a function</p>

<pre><code>bar( ?? )
</code></pre>

<p>That will accepts a variable number of parameters as well, and be able to verify that the variables are the same number (that's easy) and of the same types (the hard part) as was specified in <code>foo</code>. </p>

<p>How can I do that?</p>

<p><strong>Edit:</strong> to clarify, a call could be:</p>

<pre><code>foo (String.class, Int.class);
bar ("aaa", 32); // OK!
bar (3); // ERROR!
bar ("aa" , "bb"); //ERROR!
</code></pre>

<p>Also, foo and bar are methods of the same class.</p>
