title: Multiple object types for varargs in a method prototype?
body: <p>I'm trying to write the prototype of a Java function that can be called with any number of integers and strings:</p>
  
  <pre><code>myMethod(1, 2, 3, "Hello", "World"); // Valid call
  myMethod(4, "foo", "bar", "foobar"); // Valid call
  </code></pre>
  
  <p>Ideally, I would like the ints and strings to be given in any order (and possibly mixed):</p>
  
  <pre><code>myMethod(1, "Hello", 2, "World", 3); // Valid call
  </code></pre>
  
  <p>I thought of using varargs, but there can be only one in the prototype. Another idea I've had is to use the following prototype: </p>
  
  <pre><code>public void myMethod(Object ... objs) { [...] }
  </code></pre>
  
  <p>...but I feel that there should be a compilation error in case it is called with something other than the expected types. Of course, a runtime check (<code>instanceof</code>) could be performed, but that wouldn't be a very elegant solution, would it?</p>
  
  <p>How would you do it?</p>