This page is no longer maintained — Please continue to the home page at www.scala-lang.org

RE: How to invoke a Java's variable-length argument method in Scala?

No replies
Guofeng Zhang
Joined: 2010-08-17,
User offline. Last seen 42 years 45 weeks ago.

This works. Thanks.

-----Original Message-----
From: mahmood@notnoop.com [mailto:mahmood@notnoop.com] On Behalf Of Mahmood Ali
Sent: Tuesday, August 30, 2011 10:38 AM
To: Guofeng Zhang
Cc: scala-user (ggroups)
Subject: Re: [scala-user] How to invoke a Java's variable-length argument method in Scala?

Greetings,

You can try:

jgen.setNames(names: _*)

>
> jgen.setNames( names )
>
> causes the compiler complaint that “type mismatch; found: names.type (with
> underlying type Array[N]) required N”

- Mahmood

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland