title: generics multiple types
body: <p>Defining a method as</p>
  
  <pre><code>myMethod(Object... obj){}
  </code></pre>
  
  <p>allows arbitrary number and types of parameters to be used.</p>
  
  <p>I'd love to use generics for strict definition of the number and types of parameters.</p>
  
  <p>For example, Let's assume that the above mentioned <code>myMethod(Object...)</code> is a method in a class named <code>MyClass</code> and <code>MyClass</code> can be instantiated by default constructor.</p>
  
  <p>I need to define instances in a way similar to this:</p>
  
  <pre><code>MyClass&lt;Integer, Integer, String&gt; instance1 = new MyClass&lt;Integer, Integer, String&gt;();
  MyClass&lt;String, String, Integer, Integer&gt; instance2 = new MyClass&lt;String, String, Integer, Integer&gt;();
  </code></pre>
  
  <p>so the type definitions above will set the number and types of parameters allowed on calls to <code>myMethod()</code>:</p>
  
  <pre><code>instance1.myMethod(1, 2, "test");
  instance2.myMethod("one", "two", 1, 2);
  </code></pre>
  
  <p>The question is: How to define <code>MyClass</code> in such a way that will allow <b>any</b> number of type parameters?</p>
  
  <p>Any advice will be appreciated.</p>