title: Using varargs from Scala
body: <p>I'm tearing my hair out trying to figure out how to do the following:</p>
  <pre><code>def foo(msf: String, o: Any, os: Any*) = {
      println( String.format(msf, o :: List(os:_*)) )
  }
  </code></pre>
  <p>There's a reason why I have to declare the method with an <code>o</code> and an <code>os</code> <code>Seq</code> separately. Basically, I end up with the format method called with a single object parameter (of type <code>List </code>). Attempting:</p>
  <pre><code>def foo(msf: String, o: Any, os: Any*) = {
      println( String.format(msf, (o :: List(os:_*))).toArray )
  }
  </code></pre>
  <p>Gives me the type error:</p>
  <blockquote>
  <p>found: Array[Any]</p>
  <p>required Seq[java.lang.Object]</p>
  </blockquote>
  <p>I've tried casting, which compiles but fails for pretty much the same reason as the first example. When I try</p>
  <pre><code>println(String.format(msg, (o :: List(os:_*)) :_* ))
  </code></pre>
  <p>this fails to compile with implicit conversion ambiguity (<code>any2ArrowAssoc</code> and <code>any2stringadd</code>)</p>