capture types of varargs parameters

Posted by IttayD on Stack Overflow See other posts from Stack Overflow or by IttayD
Published on 2010-05-05T06:06:20Z Indexed on 2010/05/05 6:08 UTC
Read the original article Hit count: 166

Filed under:

Hi,

I'd like to define a method accepting varargs, so that I get the types with which it was called even in the case of nulls.

def foo(args: Any*) = ....

val s: String = null

foo(1, s) // i'd like to be able to tell in foo that args(0) is Int, args(1) is String

© Stack Overflow or respective owner

Related posts about scala